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

Brian G. Peterson brian at braverock.com
Fri Aug 17 13:55:24 CEST 2007


John Putz wrote:
> When I looked at the rollingRegression function it seems to allow you to 
> compare the performance of the fit over a rolling window.  That seems to 
> be different from what I was looking for which is to perform a fit for a 
> period from t1 to t2 and then see how it performs at predicting 
> the return at t2+1 as the window (t1,t2) rolls through the my data set.  
> Am I misunderstanding what these functions do?  At the end of the day 
> I'm looking for a vector of forecasted values that I can compare to the 
> actual (out-of-sample) values.  
> Thanks again, John.

RollingRegression performs the regression over a rolling window on a 
time series.  Nothing Else.  rollapply in zoo (which is used by 
RollingRegression) would do the same.

Regression, in and of itself, is not a predictive tool.  Unlike GARCH, 
ARIMA, etc, there is not a built-in "prediction" from a regression 
analysis.

The *comparison* of how well the ex post regression result on the 
rolling window compares to the out of sample t+1 performance is your 
(proposed) trading or analytical model.  You would need to write the 
code to do that comparison at the appropriate time lag.

Regards,

    - Brian

> ----- Original Message ----
> From: Brian G. Peterson <brian at braverock.com>
> To: John Putz <johnputz3655 at yahoo.com>
> Cc: r-sig-finance at stat.math.ethz.ch
> Sent: Thursday, August 16, 2007 10:44:51 AM
> Subject: Re: [R-SIG-Finance] best method for rolling forecast based on 
> linear fit
> 
> 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.
> 
> Regards,
> 
>     - Brian
>



More information about the R-SIG-Finance mailing list