Hi: Use arima.sim because when you have recursive relationships like that,
there's no way to
not loop. If arima.sim doesn't allow for the trend piece (0.1*t ), then you
can do that part seperately using cumsum(0.1*(1:t)) and then add it back in
to what arima.sim gives you.  I don't remember if arima.sim allows for a
trend. It might.


Mark


On Mon, Jun 25, 2012 at 8:39 AM, Kathie <kathryn.lord2...@gmail.com> wrote:

> Dear R users,
>
> I'd like to compute  X like below.
>
> X_{i,t} = 0.1*t + 2*X_{i,t-1} + W_{i,t}
>
> where W_{i,t}  are from Uniform(0,2) and X_{i,0} = 1+5*W_{i,0}
>
> Of course, I can do this with "for" statement, but I don't think it's good
> idea because "i" and "t" are too big.
>
> So, my question is that
>
> Is there any better idea to avoid "for" statement for this problem?
>
> Thank you in advance.
>
> Kathie
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/do-call-or-something-instead-of-for-tp4634421.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to