[R] Generating random walks
Hello, here is another question, how do I generate random walk models in R? Basically, I need an AR(1) model with the phi^1 value equal to 1: Yt = c + Yt-1 + E where E is random white noise. I tried using the arima.sim command: arima.sim(list(ar=c(1)), n = 1000, rand.gen = rnorm) but got this error since the model I am generating is not stationary: Error in arima.sim(list(ar = c(1)), n = 1000, rand.gen = rnorm) : 'ar' part of model is not stationary I found arima.sim sufficient for generating stationary models, but how about non-stationary models? Thanks again for your help. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Generating random walks
cumsum(rnorm(100)+c) HTH phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of oliver wee Sent: Wednesday, February 15, 2006 12:41 PM To: r-help@stat.math.ethz.ch Subject: [R] Generating random walks Hello, here is another question, how do I generate random walk models in R? Basically, I need an AR(1) model with the phi^1 value equal to 1: Yt = c + Yt-1 + E where E is random white noise. I tried using the arima.sim command: arima.sim(list(ar=c(1)), n = 1000, rand.gen = rnorm) but got this error since the model I am generating is not stationary: Error in arima.sim(list(ar = c(1)), n = 1000, rand.gen = rnorm) : 'ar' part of model is not stationary I found arima.sim sufficient for generating stationary models, but how about non-stationary models? Thanks again for your help. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Generating random walks
In retrospect x-cumsum(rnorm(n=100, mean=c)) will probably work quicker Phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Phineas Campbell Sent: Wednesday, February 15, 2006 1:01 PM To: 'R-Help Subject: Re: [R] Generating random walks cumsum(rnorm(100)+c) HTH phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of oliver wee Sent: Wednesday, February 15, 2006 12:41 PM To: r-help@stat.math.ethz.ch Subject: [R] Generating random walks Hello, here is another question, how do I generate random walk models in R? Basically, I need an AR(1) model with the phi^1 value equal to 1: Yt = c + Yt-1 + E where E is random white noise. I tried using the arima.sim command: arima.sim(list(ar=c(1)), n = 1000, rand.gen = rnorm) but got this error since the model I am generating is not stationary: Error in arima.sim(list(ar = c(1)), n = 1000, rand.gen = rnorm) : 'ar' part of model is not stationary I found arima.sim sufficient for generating stationary models, but how about non-stationary models? Thanks again for your help. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html