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

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Wed, 23 Jul 2008 10:06:03 +1200

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

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 Jul 2008 - 22:11:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Jul 2008 - 22:32:04 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive