[R] help with simulate AR(1) data
Rolf Turner
r.turner at auckland.ac.nz
Wed Jul 23 00:06:03 CEST 2008
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)) + mean
>
> (OK, so t(...) then)
Another of the many lacunae in my knowledge ... I'd either never
learned
about, or had forgotten, replicate().
BTW --- to retain the time series nature of the results, you can do:
replicate(1000, arima.sim(list(ar=.3),100) + mean, simplify=FALSE)
cheers,
Rolf
P. S. Just occurred to me --- ``mean'' is a Bad Name for a mean
vector, since
there is a function called ``mean''. No disasters imminent, but it's
a bad
policy.
R.
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
More information about the R-help
mailing list