Home   >   User Resources   >   Online Help   >   apaOLS.ForwardStagewise
 

 

Function index Version 3.0.0

apaOLS.ForwardStagewise(X, Y, StepSize, nSteps)

Excel=apaOLS.ForwardStagewise(X, Y, StepSize, nSteps)

Result

Performs an incremental forward stagewise linear regression for nSteps steps and returns the coefficient path: a matrix of nSteps rows and 2 + columns(X) columns. Column 1 holds the R2, column 2 the intercept and the remaining columns the betas of the X variables in their original units, each row after the corresponding step.

Syntax

X: rows x columns matrix of regressors, one variable per column

Y: rows x 1 vector of the dependent variable

StepSize: positive increment of the standardized coefficient added in each step, typically a small number such as 0.01

nSteps: number of steps to calculate, at least 1

Remarks

The X columns are standardized internally to mean 0 and population standard deviation 1, and Y is centered. In each step the standardized variable with the largest absolute covariance with the current residual (equivalently the largest absolute correlation) is selected; ties go to the lowest column index. Its standardized coefficient is moved by StepSize in the direction of that covariance and the residual is updated. The betas are converted back to the original units, so the result does not depend on the scaling of X, and the intercept equals the mean of Y minus the means of X times the betas.

The R2 is the in-sample coefficient of determination of the fitted values including the intercept, 1 - SSR/SST, with SST the sum of squared deviations of Y from its mean.

The algorithm does not stop at convergence; it executes the number of steps given. For a small StepSize the betas approach the OLS betas with an intercept; once there, one coefficient oscillates by StepSize. If the residual is explained exactly, the remaining rows show #N/A. Constant X columns are never selected and keep a beta of 0. X and Y must have the same number of rows and must not contain missing values.