that's an AR(1) with a constant added each time so you could use arima.sim
and add the constant in afterwards. but I don't know how that fast that is.

I started to check if there was a relation cumprod wise but I didn't get
far.

z[4] = a[4]*a[3]*a[2] + a[4]*a[3] + a[4]*b[3] + b[4]


for z[5] you multiply above by a[5] and add in b[5] but I don't see it
being useful.




On Wed, Jan 25, 2012 at 3:05 PM, Berend Hasselman <b...@xs4all.nl> wrote:

>
> On 25-01-2012, at 21:00, Berend Hasselman wrote:
>
> >
> > On 25-01-2012, at 19:09, patzoul wrote:
> >
> >> I have 2 series of data a,b and I would like to calculate a new series
> which
> >> is z[t] = z[t-1]*a[t] + b[t] , z[1] = b[1].
> >> How can I do that without using a loop?
> >
> > ?filter
>
> Oops. filter only works with a and b both constants.
>
> Berend
>
> ______________________________________________
> 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