Re: [R] do.call or something instead of for

2012-06-25 Thread Rolf Turner
On 26/06/12 00:39, Kathie 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

Re: [R] do.call or something instead of for

2012-06-25 Thread Mark Leeds
thanks peter. I was thinking more about t but you're right in that there's an i there also. my bad ( twice ). On Mon, Jun 25, 2012 at 9:37 AM, Petr Savicky wrote: > On Mon, Jun 25, 2012 at 05:39:45AM -0700, Kathie wrote: > > Dear R users, > > > > I'd like to compute X like below. > > > > X_{i

Re: [R] do.call or something instead of for

2012-06-25 Thread Petr Savicky
On Mon, Jun 25, 2012 at 05:39:45AM -0700, Kathie 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

Re: [R] do.call or something instead of for

2012-06-25 Thread Mark Leeds
Hi Kathryn: I'm sorry because I didn't read your question carefully enough. arima.sim won't help because you don't have a normal error term. I think you have to loop unless someone else knows of a way that I'm not aware of. good luck. On Mon, Jun 25, 2012 at 8:39 AM, Kathie wrote: > Dear R us

Re: [R] do.call or something instead of for

2012-06-25 Thread Mark Leeds
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 arim

[R] do.call or something instead of for

2012-06-25 Thread Kathie
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