-------------------------------------------------------------------------------
help for rollreg 
-------------------------------------------------------------------------------

Rolling regression estimates

rollreg [depvar varlist] [if exp] [in range], move(#) | add(#) | dropfirst(#) stub(abbrev) [ robust bw(#) kernel(choice) noconstant graph(summary|full) ]

rollreg is for use with time-series data. You must tsset your data before using these routines. depvar and varlist may contain time-series operators. The data may be defined as panel data, in which case the rolling regression estimates will be estimated for each time series in the panel.

Description

rollreg computes three different varieties of rolling regression estimates. With the move() option, moving-window estimates of the specified window width are computed for the available sample period. With the add() option, that number of periods are initially used for estimation, and the sample is extended one period at a time through the remaining sample. With the dropfirst() option, the regression is estimated for the entire sample, and then repeated, dropping initial observations until that number of observations have been excluded. All three forms of the command generate timeseries of R^2s, RMSEs, coefficient estimates and their estimated standard errors for each period.

Options

One (and only one) of the options move, add, or dropfirst must be specified.

move(#) specifies the width of the moving window for which the regression is to be estimated. It must be less than the sample size and greater than the number of regressors (including the constant term). When the move option is used, the generated timeseries are aligned with the last period of the window: e.g. move(24) would define an R^2 series starting in observation 24 of the defined sample.

add(#) specifies the initial size of the window for which the regression is to be estimated. It must be less than the sample size and greater than the number of regressors (including the constant term). The regression will be run over the first add() observations of the defined sample, then run again adding the following period, and so on, until the full sample has been employed. When the add option is used, the generated timeseries are aligned with the last period of the window: e.g. add(24) would define an R^2 series starting in observation 24 of the defined sample.

dropfirst(#) specifies the maximum number of periods to be omitted from the regression. It must be less than the sample size. The regression will be run over the entire defined sample, then run again dropping the first period, and so on, until the initial dropfirst() observations have been omitted from the regression. When the dropfirst option is used, the generated timeseries are aligned with the first period of the window: e.g. dropfirst(24) would define an R^2 series of 24 observations starting in observation 1 of the defined sample.

stub(abbrev), which must be provided, specifies the "stub" from which new variable names will be created. Three summary variables are created: stub_r2, stub_RMSE and stub_N, containing the R^2, RMSE and N for each set of estimates. Two additional variables are created for each regressor: stub_varname and stub_se_varname for the point estimate and estimated standard error, respectively. If robust is employed, the standard errors are labelled stub_Rob_se_varname; if the bw option is employed, the standard errors are labelled stub_AC_se_varname; and if both robust and bw options are employed, the standard errors are labelled stub_HAC_se_varname. Variables created by stub must be new variables. If the varlist contains time-series operators, the dots in their names are replaced by underscores so that the resulting new variables' names are legal.

robust specifies that the rolling regressions are to be estimated with the robust option of regress. That is, the estimated standard errors are to be robust to arbitrary heteroskedasticity in the error distribution.

bw(#) specifies the bandwidth to be employed in estimating the standard errors of the coefficients using autocorrelation-robust techniques. The user-written routine ivreg2 must be installed (via ssc install ivreg2) if this option is to be employed. Please see help ivreg2 for details of the bandwidth option. For the default (Bartlett) kernel, bw(n) corresponds to newey with lag(n-1). If both robust and bw options are specified, the estimated standard errors are "HAC": heteroskedasticity- and autocorrelation-consistent, per Newey-West (help newey). However, other kernels may be employed (see below), and unlike newey, ivreg2 can calculate "AC" errors without a correction for heteroskedasticity. However, in that case the covariance matrix is not guaranteed to be positive definite.

kernel() Selects the kernel to be employed in autocorrelation-consistent standard error estimation (requires specification of lag()). If not specified, defaults to the Bartlett kernel. For more details, please see help ivreg2.

noconstant Specifies that no constant term is to be included in the regression.

graph() with option value summary specifies that a graph of the R^2 and RMSE values be displayed and saved as stub__summ.gph. The R^2 and RMSE values resulting from a single regression over the entire sample will also be displayed on the graph. Option value full requests this graph, and in addition requests a graph containing each regressor's sequence of coefficient estimates with standard error bands. The width of the confidence interval is that specified as the default level. The coefficient estimates, and standard error bands, resulting from a single regression over the entire sample will also be displayed on the graph. This additional graph will be displayed and saved as stub_coeff.gph. Prior graphs with these names will be discarded. Graphics are not available when multiple units of a panel are included in the defined sample.

Examples

. webuse wpi1 . g t2 = t^2

. rollreg D.wpi t t2, move(24) stub(wpiM) graph(summary)

. rollreg D.wpi t t2, add(24) stub(wpiA)

. rollreg D.wpi t t2, dropfirst(48) stub(wpiD) bw(3) graph(summary)

. rollreg D2.wpi LD.wpi LD2.wpi t, move(48) stub(wpiM2) robust graph(full)

. webuse invest2 . tsset company time

. rollreg market L(0/1).invest time, move(8) stub(mktM)

References

Amano, Robert, Gable, Jeff and Simon van Norden, 1993. "ROLLREG.SRC: A RATS procedure for rolling OLS regressions." Bank of Canada. http://ideas.repec.org/c/boc/bocode/r852701.html

Author

Christopher F. Baum (baum@bc.edu), Boston College

Acknowledgements

This module was adapted from RATS code cited above. I thank Nicholas J. Cox and Vince Wiggins for their useful suggestions, and Cameron Hooper for pointing out a bug in the code.

Also see help for ivreg2 (SSC)