> On Mon, 5 Oct 2009, Data Analytics Corp. wrote: > > I need to do a simple thing which seemed to work before, but now it's > > not. Suppose I have a work space with the S&P 500 closing numbers by > > month. I now want to create a random walk. I used > > > > genr y = 0 > > genr y = y(-1) + randgen(N, 0, 1) > > > > but it doesn't like the ( in the y(-1). How can I get this to work?
On 10/6/2009 10:56 AM, Allin Cottrell wrote: > "genr y = 0" creates a scalar variable, for which the y(-1) syntax > is not applicable: do "series y = 0" instead. You'd also be more > efficient generating your random quantities in one go: > > series u = normal() > series y = 0 > y = y(-1) + u Once you have u, I think you can just do: y = cum(u) Alan Isaac