SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 24986: All-possible-regressions selection based on PRESS or other statistics

DetailsResultsDownloadsAboutRate It

All-possible-regressions selection based on PRESS or other statistics

Contents: Purpose / History / Requirements / Usage / Details / Limitations
PURPOSE:
Provide all-possible-regressions model-selection based on the SELECTION= RSQUARE, ADJRSQ, and CP and display any of the following model statistics: Mallows' Cp (_CP_), predicted residual sum of squares (_PRESS_), root mean square error (_RMSE_), mean square error (_MSE_), R2 (_RSQ_), adjusted R2 (_ADJRSQ_), Akaike's information criterion (_AIC_), Sawa's Bayesian information criterion (_BIC_), or Schwarz's Bayesian criterion (_SBC_).
HISTORY:
Version 1.1: Merged all code into single macro. Added print= and out= parameters. Fixed data= so that it analyzes last-created data set.
REQUIREMENTS:
SAS 8 or later of Base SAS and SAS/STAT Software.
USAGE:
Follow the instructions in the Downloads tab of this sample to save the %ALLSUBSREG macro definition. Replace the text within quotes in the following statement with the location of the %ALLSUBSREG macro definition file on your system. In your SAS program or in the SAS editor window, specify this statement to define the %ALLSUBSREG macro and make it available for use:
   %inc "<location of your file containing the ALLSUBSREG macro>";

Following this statement, you may call the %ALLSUBSREG macro. See the Results tab for an example.

The following macro parameters are required:

depvar=
The name of the dependent (response) variable.
indepvar=
The names of the independent variables, separated by spaces.

The following macro parameters are optional:

data=
The name of the input data set to be analyzed. If not specified, the last-created data set will be analyzed.
out=
The name of the output data set containing the statistics for all models. If not specified, the data set name is _FINAL.
method=RSQUARE | ADJRSQ | CP
The type of the all-subset model-selection method to be used in the regression analysis. One of the following three methods can be specified: RSQUARE, ADJRSQ, or CP. RSQUARE is the default.
print=yes | no
Indicates if all models and related statistics should be displayed. The default is yes. The results are displayed by model size.
sortvar=
The name of the variable by which the model statistics table should be sorted within each model size. By default, the table is sorted by increasing model size (the number of variables in the model, _IN_). If sortvar= is specified, the table is further sorted within model size by descending value of the specified variable. The sortvar= parameter may be one of these model statistics:
    _P_ _CP_ _PRESS_ _RMSE_ _MSE_ _RSQ_ _ADJRSQ_ 
    _AIC_ _BIC_ _SBC_
printvar=
The names of the model statistics to be displayed in the model statistics table. printvar= is ignored if print=no. If not specified, the final table displays VarsInModel, _IN_, all model statistics, and parameter estimates. The printvar= parameter allows you to select the model statistics displayed in the table. One or more of the following may be specified, separated by spaces:
    _P_ _CP_ _PRESS_ _RMSE_ _MSE_ _RSQ_ _ADJRSQ_ 
    _AIC_ _BIC_ _SBC_
DETAILS:
PROC REG provides all possible regression methods such as SELECTION= RSQUARE, ADJRSQ, CP. The RSQUARE method can efficiently perform all possible subset regressions and display the models in decreasing order of rsquare magnitude within each subset size. Other statistics such as CP, RMSE, MSE, RSQ, ADJRSQ, AIC, BIC, and SBC are available for comparing subsets of different sizes. These statistics, the PRESS statistic, and the estimated regression coefficients can be displayed or output to a SAS data set.
LIMITATIONS:
CLASS variables are not supported. The absolute PRESS statistic is not provided. Note that all possible regression methods can be very resource intensive and should only be used with a relatively small number of potential regressors.



These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.