[R] R: lags

Thomas Lumley tlumley at u.washington.edu
Tue Feb 10 16:28:37 CET 2004


On Tue, 10 Feb 2004, allan clark wrote:

> hi all
>
> how does one simulate a random walk process?
>
> i.e
>
> y(0)=0
>
> y(t)=y(t-1)+ e(t)
>
> where e(t) is normal(0,1)  say.
>

e<-rnorm(100)
y<-cumsum(e)

	-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list