[R-SIG-Finance] best method for rolling forecast based on linear fit

Brian G. Peterson brian at braverock.com
Thu Aug 16 19:44:51 CEST 2007

John Putz wrote:
> Hello,
> A basic question.  Can anybody point me towards the best method to use to perform a rolling 1 step ahead forecast of a price series based on a rolling N day linear fit?  I believe I used the dse package in the past, but my recollection is it was somewhat cumbersome.

If you're using a linear model as your predictor, it's not strictly 
speaking a "one step ahead" prediction, but rather an ex post rolling 
window analysis.

"best" is highly subjective depending on how fancy you want to be.

zoo has the rollapply function with a configurable window to roll over.

The rollingRegression function in PerformanceAnalytics might make things 
a little easier to use.

There are also many robust regressors that you might wish to consider, 
especially if you're using a relatively short window.


    - Brian

More information about the R-SIG-Finance mailing list