SAS : Repeated Estimation of Stepwise Regressions by Group

This post presents a SAS code for estimating regression models by group with a stepwise variable selection.


Repeated Estimation of Stepwise Regressions by Group



We use the sashelp.baseball dataset as a sample data which was used in the previous post below.



We assume that work.base2 dataset is prepared, which has the number and name of groups based on Team column. work.base2 is already created in the previous post.


Stepwise Regression with a group name as the model name


Given work.base2 dataset, the following SAS code performs an estimation of stepwise linear regression model. This SAS code is same as that of the previous post except the treatment of a stepwise option.

SAS : Repeated Estimation of Stepwise Regressions by Group


Repeated regressions by using a do-loop


For repeated estimation of regressions, the following SAS macro code is implemented for retrieving array of group names and multiple estimations are carried out using a do-loop.

SAS : Repeated Estimation of Stepwise Regressions by Group


The following output is estimation results of stepwise regressions with fixed_var_no = 0.

SAS : Repeated Estimation of Stepwise Regressions by Group

There are, however, many cases where some variables are fixed in advance. In this case fixed_var_no = k is used, which means that the first n-th variables are always selected. The following output shows this kind of stepwise regressions with fixed variables (nAtBat nHits).

SAS : Repeated Estimation of Stepwise Regressions by Group

Period.

No comments:

Post a Comment

Tentative Topics (Keeping Track to Avoid Forgetting)

Segmented Nelson-Siegel model
Shifting Endpoints Nelson-Siegel model
Nadaraya-Watson estimator
Locally weighted scatterplot smoothing (LOWESS)
Time-Varying Parameter Vector Autoregressions (TVP-VAR)
Time-varying or Dynamic Copula
Bayesian VAR
Adrian-Crump-Moench (ACM) term premium model
GARCH-EVT-Copula approach