This might be obvious to some, but I can't find a neat way to do it: Say I have two (very long) numerical vectors a & b of the same length representing variable coefficients of a linear autoregression.
I want to calculate vector x defined by x[1] <- b[1] for (n in 2:length(a)) x[n] <- a[n]*x[n-1] + b[n] Is there a way to do this vectorially, i.e. without using the 'for' loop? Thanks, Sandor ______________________________________________ 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.