Re: [R] R: lags

2004-02-10 Thread Peter Dalgaard
allan clark <[EMAIL PROTECTED]> writes: > 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.g., c(0,cumsum(rnorm(1000))) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Bi

Re: [R] R: lags

2004-02-10 Thread John Fox
Dear Alan, Perhaps there's a more clever solution, but the following will work and follows directly from your statement of the problem (e.g., for 100 observations): e <- rnorm(100) y <- rep(0, 101) for (t in 2:101) y[t] <- y[t-1] + e[t] y <- y[-1] I hope that this helps, John On Tue, 10 Feb 20

Re: [R] R: lags

2004-02-10 Thread Thomas Lumley
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 [EMAIL PROT

Re: [R] R: lags

2004-02-10 Thread ekstrom
> 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. cumsum(c(0,rnorm(1))) ? Claus -- * Claus Thorn Ekstrøm <[EMAIL PROTECTED]> Dept of Mathematics and Physics, KVL Thorvaldse

Re: [R] R: lags

2004-02-10 Thread Anders Nielsen
How about: y<-cumsum(c(0,rnorm(100))) 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. > > Regards > allan > __ [EMAIL PRO

RE: [R] R: lags

2004-02-10 Thread Wayne Jones
inal Message- From: allan clark [mailto:[EMAIL PROTECTED] Sent: 10 February 2004 14:48 To: Rhelp Subject: [R] R: lags 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. Regards allan KSS Ltd Seventh Floor St James's Bui

[R] R: lags

2004-02-10 Thread allan clark
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. Regards allan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

Re: [R] R: lags and plots

2004-02-03 Thread Martin Maechler
> "allan" == allan clark <[EMAIL PROTECTED]> > on Tue, 03 Feb 2004 13:57:53 +0200 writes: allan> Hi all I want to calculate certain lags of a time allan> series and plot them simultaneously on a graph. can allan> anyone help? Use lag.plot() {name and part of UI is for S+

Re: [R] R: lags and plots

2004-02-03 Thread Achim Zeileis
On Tue, 03 Feb 2004 13:57:53 +0200 allan clark wrote: > Hi all > > I want to calculate certain lags of a time series and plot them > simultaneously on a graph. can anyone help? Something like this? R> x <- ts(cumsum(rnorm(20)), start = 0, freq = 10) R> plot(x) R> lines(lag(x, k = -1), col = 4)

RE: [R] R: lags and plots

2004-02-03 Thread Wayne Jones
?lag.plot -Original Message- From: allan clark [mailto:[EMAIL PROTECTED] Sent: 03 February 2004 11:58 To: Rhelp Subject: [R] R: lags and plots Hi all I want to calculate certain lags of a time series and plot them simultaneously on a graph. can anyone help? KSS Ltd Seventh Floor

Re: [R] R: lags and plots

2004-02-03 Thread Spencer Graves
Consider the following: plot(1:9, (1:10)[-1]) lines(1:9, (1:10)[-10]) Does this help? spencer graves allan clark wrote: Hi all I want to calculate certain lags of a time series and plot them simultaneously on a graph. can anyone help?

[R] R: lags and plots

2004-02-03 Thread allan clark
Hi all I want to calculate certain lags of a time series and plot them simultaneously on a graph. can anyone help? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-pr