RE: [R] R: lags

2004-02-10 Thread Wayne Jones
Try this for size: Not a very efficient way to do it though!!! Get.Random.Walk-function(){ length.walk-1000 rand.walk-rep(0,length.walk) for(i in 2:length.walk) { rand.walk[i]-rand.walk[i-1]+rnorm(1, mean=0, sd=1) } return(rand.walk) } plot(Get.Random.Walk()) -Original Message-

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 PROTECTED] mailing

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 PROTECTED]

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 Biostatistics

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 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) hth Z

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+ compatibility}