Rolling regression

This macro performs a rolling regression, which allows you to check for changes in the regression coefficients over time. The first iteration runs a regression on rows 1 through k. The second iteration runs a regression on the rows 2 through k+1. The third iteration runs a regression on rows 3 through k+2 and so on.

This macro performs a rolling regression, which allows you to check for changes in the regression coefficients over time. The first iteration runs a regression on rows 1 through k. The second iteration runs a regression on the rows 2 through k+1. The third iteration runs a regression on rows 3 through k+2 and so on.

Download the Macro

Be sure that Minitab knows where to find your downloaded macro. Choose File > Options > General. Under Macro location browse to the location where you save macro files.

Important

If you use an older web browser, when you click the Download button, the file may open in Quicktime, which shares the .mac file extension with Minitab macros. To save the macro, right-click the Download button and choose Save target as.

Required Inputs

  • A column of response data
  • One or more columns of predictor data
  • The number of rows of data you want to consider at each iteration of the regression

Optional Inputs

ANCHOR
Specify to use rows 1 through k for the first iteration and rows 1 through k+1 for the second iteration and rows 1 through k+2 for the third iteration and so on. The data used in the regression is anchored at row 1.

Running the Macro

Suppose the response data are in C1, and the predictors are in C2, C3, and C4. You want to check for changes in the coefficients looking at 12 rows of data at a time. To run the macro, choose View > Command Line/History and type:
%ROLLING C1 C2 C3 C4 12

Click Run.