On Sun, 6 Sep 2009, Data Analytics Corp. wrote:
I'm still new to GRETL, so please pardon a simple question. I
want my
students to generate a simple random walk of, say 1000 values, so that
they can compare (graph) this against changes in the DOW. How is a
random walk generated in GRETL? More fundamentally, how do I lag a
series and use it on the right-hand-side?
Here's an illustration of a couple of ways of doing it:
nulldata 10
series u = normal()
# just for comparability
u[1] = 0
# method 1: just cumulate u
series rwalk1 = cum(u)
# method 2: use autoregressive formula
series rwalk2 = 0
rwalk2 = rwalk2(-1) + u
print rwalk1 rwalk2 --byobs
Allin Cottrell