Re: [R] help with simulate AR(1) data

2008-07-22 Thread Rolf Turner
On 23/07/2008, at 9:50 AM, Peter Dalgaard wrote: Rolf Turner wrote: matrix(unlist(lapply(1:1000,function(x){arima.sim(list(ar=0.3), 100)+mean})),nrow=1000,byrow=TRUE) Whatever did replicate() ever do to you to deserve getting so rudely ignored? replicate(1000, arima.sim(list(ar=.3),100))

Re: [R] help with simulate AR(1) data

2008-07-22 Thread Peter Dalgaard
Rolf Turner wrote: matrix(unlist(lapply(1:1000,function(x){arima.sim(list(ar=0.3),100)+mean})),nrow=1000,byrow=TRUE) Whatever did replicate() ever do to you to deserve getting so rudely ignored? replicate(1000, arima.sim(list(ar=.3),100)) + mean (OK, so t(...) then) -- O__ Peter D

Re: [R] help with simulate AR(1) data

2008-07-22 Thread Rolf Turner
On 23/07/2008, at 7:52 AM, cathelf wrote: Hi, sorry for bothering your guys again. I want to simulate 100 AR(1) data with cor(x_t, x_t-1)=rho=0.3. The mean of the first 70 data (x_1 to x_70) is 0 and the mean of the last 30 data (x_71 to x_100) is 2. Can I do it in the following way? x <

[R] help with simulate AR(1) data

2008-07-22 Thread cathelf
Hi, sorry for bothering your guys again. I want to simulate 100 AR(1) data with cor(x_t, x_t-1)=rho=0.3. The mean of the first 70 data (x_1 to x_70) is 0 and the mean of the last 30 data (x_71 to x_100) is 2. Can I do it in the following way? x <- arima.sim(list=(ar=0.3), 100) mean <- c(rep(0, 70