The GLMSELECT Procedure

Getting Started: GLMSELECT Procedure

(View the complete code for this example.)

The Sashelp.Baseball data set contains salary and performance information for Major League Baseball players who played at least one game in both the 1986 and 1987 seasons, excluding pitchers. The salaries (Sports Illustrated, April 20, 1987) are for the 1987 season and the performance measures are from 1986 (Collier Books, The 1987 Baseball Encyclopedia Update). The following step displays in Figure 50.1 the variables in the data set:

proc contents varnum data=sashelp.baseball;
   ods select position;
run;

Suppose you want to investigate whether you can model the players’ salaries for the 1987 season based on performance measures for the previous season. The aim is to obtain a parsimonious model that does not overfit this particular data, making it useful for prediction. This example shows how you can use PROC GLMSELECT as a starting point for such an analysis. Since the variation of salaries is much greater for the higher salaries, it is appropriate to apply a log transformation to the salaries before doing the model selection.

The following code selects a model with the default settings:

ods graphics on;
proc glmselect data=sashelp.baseball plots=all;
   class league division;
   model logSalary = nAtBat nHits nHome nRuns nRBI nBB
                     yrMajor crAtBat crHits crHome crRuns crRbi
                     crBB league division nOuts nAssts nError
                   / details=all stats=all;
run;
ods graphics off;

PROC GLMSELECT performs effect selection where effects can contain classification variables that you specify in a CLASS statement. The "Class Level Information" table shown in Figure 50.2 lists the levels of the classification variables Division and League.

Figure 50.1: Sashelp.Baseball Data Set

The CONTENTS Procedure

Variables in Creation Order
#VariableTypeLenLabel
1NameChar18Player's Name
2TeamChar14Team at the End of 1986
3nAtBatNum8Times at Bat in 1986
4nHitsNum8Hits in 1986
5nHomeNum8Home Runs in 1986
6nRunsNum8Runs in 1986
7nRBINum8RBIs in 1986
8nBBNum8Walks in 1986
9YrMajorNum8Years in the Major Leagues
10CrAtBatNum8Career Times at Bat
11CrHitsNum8Career Hits
12CrHomeNum8Career Home Runs
13CrRunsNum8Career Runs
14CrRbiNum8Career RBIs
15CrBBNum8Career Walks
16LeagueChar8League at the End of 1986
17DivisionChar8Division at the End of 1986
18PositionChar8Position(s) in 1986
19nOutsNum8Put Outs in 1986
20nAsstsNum8Assists in 1986
21nErrorNum8Errors in 1986
22SalaryNum81987 Salary in $ Thousands
23DivChar16League and Division
24logSalaryNum8Log Salary


Figure 50.2: Class Level Information

The GLMSELECT Procedure

Class Level Information
ClassLevelsValues
League2American National
Division2East West


When you specify effects that contain classification variables, the number of parameters is usually larger than the number of effects. The "Dimensions" table in Figure 50.3 shows the number of effects and the number of parameters considered.

Figure 50.3: Dimensions

Dimensions
Number of Effects19
Number of Parameters21


Figure 50.4: Model Information

The GLMSELECT Procedure

Data SetSASHELP.BASEBALL
Dependent VariablelogSalary
Selection MethodStepwise
Select CriterionSBC
Stop CriterionSBC
Effect Hierarchy EnforcedNone


You find details of the default search settings in the "Model Information" table shown in Figure 50.4. The default selection method is a variant of the traditional stepwise selection where the decisions about what effects to add or drop at any step and when to terminate the selection are both based on the Schwarz Bayesian information criterion (SBC). The effect in the current model whose removal yields the maximal decrease in the SBC statistic is dropped provided this lowers the SBC value. Once no decrease in the SBC value can be obtained by dropping an effect in the model, the effect whose addition to the model yields the lowest SBC statistic is added and the whole process is repeated. The method terminates when dropping or adding any effect increases the SBC statistic.

Figure 50.5: Candidates for Entry at Step Two

Best 10 Entry Candidates
RankEffectSBC
1nHits-252.5794
2nAtBat-241.5789
3nRuns-240.1010
4nRBI-232.2880
5nBB-223.3741
6nHome-208.0565
7nOuts-205.8107
8Division-194.4688
9CrBB-191.5141
10nAssts-190.9425


The DETAILS=ALL option requests details of each step of the selection process. The "Best 10 Entry Candidates" table at each step shows the candidates for inclusion or removal at that step ranked from best to worst in terms of the selection criterion, which in this example is the SBC statistic. By default only the 10 best candidates are shown. Figure 50.5 shows the candidate table at step two.

To help in the interpretation of the selection process, you can use graphics supported by PROC GLMSELECT. ODS Graphics must be enabled before requesting plots. For general information about ODS Graphics, see Chapter 21: Statistical Graphics Using ODS. With ODS Graphics enabled, the PLOTS=ALL option together with the DETAILS=STEPS option in the MODEL statement produces a needle plot view of the "Candidates" tables. The plot corresponding to the "Candidates" table at step two is shown in Figure 50.6. You can see that adding the effect nHits yields the smallest SBC value, and so this effect is added at step two.

Figure 50.6: Needle Plot of Entry Candidates at Step Two

Needle Plot of Entry Candidates at Step Two


The "Stepwise Selection Summary" table in Figure 50.7 shows the effect that was added or dropped at each step of the selection process together with fit statistics for the model at each step. The STATS=ALL option in the MODEL statement requests that all the available fit statistics are displayed. See the section Criteria Used in Model Selection Methods for descriptions and formulas. The criterion panel in Figure 50.8 provides a graphical view of the progression of these fit criteria as the selection process evolves. Note that none of these criteria has a local optimum before step five.

Figure 50.7: Selection Summary Table

The GLMSELECT Procedure

Stepwise Selection Summary
StepEffect
Entered
Effect
Removed
Number
Effects In
Number
Parms In
Model
R-Square
Adjusted
R-Square
AIC AICC BIC CP SBC PRESS ASEF ValuePr > F
0Intercept 110.00000.0000204.2238204.2699-60.6397375.9275-57.2041208.73810.78770.001.0000
1CrRuns 220.41870.416563.539163.6318-200.7872111.2315-194.3166123.91950.4578188.01<.0001
2nHits 330.54400.54051.70411.8592-261.880733.4438-252.579497.63680.359271.42<.0001
3YrMajor 440.57050.5655-12.0208-11.7873-275.333318.5870-262.732292.29980.338315.96<.0001
4 CrRuns330.56140.5581-8.5517-8.3967-271.909522.3357-262.835393.14820.34545.440.0204
5nBB 440.58180.5770*-19.0690*-18.8356*-282.1700*11.3524*-269.7804*89.5434*0.329412.620.0005
* Optimal Value of Criterion


The stop reason and stop details tables in Figure 50.9 gives details of why the selection process terminated. This table shows that at step five the best add candidate, Division, and the best drop candidate, nBB, yield models with SBC values of –268.6094 and –262.8353, respectively. Both of these values are larger than the current SBC value of –269.7804, and so the selection process stops at the model at step five.

Figure 50.8: Criterion Panel

Criterion Panel


Figure 50.9: Stopping Details

Selection stopped at a local minimum of the SBC criterion.

Stop Details
Candidate
For
EffectCandidate
SBC
 Compare
SBC
EntryDivision-268.6094>-269.7804
RemovalnBB-262.8353>-269.7804


The coefficient panel in Figure 50.10 enables you to visualize the selection process. In this plot, standardized coefficients of all the effects selected at some step of the stepwise method are plotted as a function of the step number. This enables you to assess the relative importance of the effects selected at any step of the selection process as well as providing information as to when effects entered the model. The lower plot in the panel shows how the criterion used to choose the selected model changes as effects enter or leave the model.

Figure 50.10: Coefficient Progression

Coefficient Progression


The selected effects, analysis of variance, fit statistics, and parameter estimates tables shown in Figure 50.11 give details of the selected model.

Figure 50.11: Details of the Selected Model

The GLMSELECT Procedure
Selected Model


The selected model is the model at the last step (Step 5).

Effects:Intercept nHits nBB YrMajor

Analysis of Variance
SourceDFSum of
Squares
Mean
Square
F Value
Model3120.5255340.17518120.12
Error25986.628200.33447 
Corrected Total262207.15373  

Root MSE0.57834
Dependent Mean5.92722
R-Square0.5818
Adj R-Sq0.5770
AIC-19.06903
AICC-18.83557
BIC-282.17004
C(p)11.35235
PRESS89.54336
SBC-269.78041
ASE0.32938

Parameter Estimates
ParameterDFEstimateStandard
Error
t Value
Intercept14.0139110.11129036.07
nHits10.0079290.0009947.98
nBB10.0072800.0020493.55
YrMajor10.1006630.00755113.33


PROC GLMSELECT provides you with the flexibility to use several selection methods and many fit criteria for selecting effects that enter or leave the model. You can also specify criteria to determine when to stop the selection process and to choose among the models at each step of the selection process. You can find continued exploration of the baseball data that uses a variety of these methods in Example 50.1.