The GLMSELECT Procedure

Example 50.4 Multimember Effects and the Design Matrix

(View the complete code for this example.)

This example shows how you can use multimember effects to build predictive models. It also demonstrates several features of the OUTDESIGN= option in the PROC GLMSELECT statement.

The simulated data for this example describe a two-week summer tennis camp. The tennis ability of each camper was assessed and ratings were assigned at the beginning and end of the camp. The camp consisted of supervised group instruction in the mornings with a number of different options in the afternoons. Campers could elect to participate in unsupervised practice and play. Some campers paid for one or more individual lessons from 30 to 90 minutes in length, focusing on forehand and backhand strokes and volleying. The aim of this example is to build a predictive model for the rating improvement of each camper based on the times the camper spent doing each activity and several other variables, including the age, gender, and initial rating of the camper.

The following statements produce the TennisCamp data set:

data TennisCamp;
   length forehandCoach $6 backhandCoach $6 volleyCoach $6 gender $1;
   input forehandCoach backhandCoach volleyCoach tLessons tPractice tPlay
         gender inRating nPastCamps age tForehand tBackhand tVolley
         improvement;
   label forehandCoach = "Forehand lesson coach"
         backhandCoach = "Backhand lesson coach"
         volleyCoach   = "Volley   lesson coach"
         tForehand     = "time (1/2 hours) of forehand lesson"
         tBackhand     = "time (1/2 hours) of backhand lesson"
         tVolley       = "time (1/2 hours) of volley lesson"
         tLessons      = "time (1/2 hours) of all lessons"
         tPractice     = "total practice time (hours)"
         tPlay         = "total play time (hours)"
         nPastCamps    = "Number of previous camps attended"
         age           = "age (years)"
         inRating      = "Rating at camp start"
         improvement   = "Rating improvement at end of camp";
   datalines;
.        .        Tom     1   30   19   f   44   0   13   0   0   1    6
Greg     .        .       2   12   33   f   48   2   15   2   0   0   14
.        .        Mike    2   12   24   m   53   0   15   0   0   2   13
.        Mike     .       1   12   28   f   48   0   13   0   1   0   11
.        Bruna    .       2   13   34   f   57   0   16   0   2   0   12

   ... more lines ...   

.        .        .       0   12   38   m   47   1   15   0   0   0    8
Greg     Tom      Tom     6    3   41   m   48   2   15   2   1   3   19
.        Greg     Mike    5   30   16   m   52   0   13   0   2   3   18
;

A multimember effect (see the section EFFECT Statement in Chapter 19: Shared Concepts and Topics) is appropriate for modeling the effect of coaches on the campers’ improvement, because campers might have worked with multiple coaches. Furthermore, since the time a coach spent with each camper varies, it is appropriate to use these times to weight each coach’s contribution in the multimember effect. It is also important not to exclude campers from the analysis if they did not receive any individual instruction. You can accomplish all these goals by using a multimember effect defined as follows:

class forehandCoach backhandCoach volleyCoach;
effect coach = MM(forehandCoach backhandCoach volleyCoach/ noeffect
                  weight=(tForehand tBackhand tVolley));

Based on similar previous studies, it is known that the time spent practicing should not be included linearly, because there are diminishing returns and perhaps even counterproductive effects beyond about 25 hours. A spline effect with a single knot at 25 provides flexibility in modeling effect of practice time.

The following statements use PROC GLMSELECT to select effects for the model.

proc glmselect data=TennisCamp outdesign=designCamp;
   class forehandCoach backhandCoach volleyCoach gender;

   effect coach    = mm(forehandCoach backhandCoach volleyCoach / noeffect
                         details weight=(tForehand tBackhand tVolley));
   effect practice = spline(tPractice/knotmethod=list(25) details);

   model improvement = coach practice tLessons tPlay age gender
                       inRating nPastCamps;
run;

Output 50.4.1 shows the class level and MM level information. The levels of the constructed MM effect are the union of the levels of its constituent classification variables. The MM level information is not displayed by default—you request this table by specifying the DETAILS suboption in the relevant EFFECT statement.

Output 50.4.1: Levels of MM EFFECT Coach

The GLMSELECT Procedure

Class Level Information
ClassLevelsValues
forehandCoach5Bruna Elaine Greg Mike Tom
backhandCoach5Bruna Elaine Greg Mike Tom
volleyCoach5Andy Bruna Greg Mike Tom
gender2f m



The GLMSELECT Procedure

Level Details for MM Effect coach
LevelsValues
6Andy Bruna Elaine Greg Mike Tom


Output 50.4.2 shows the parameter estimates for the selected model. You can see that the constructed multimember effect coach and the spline effect practice are both included in the selected model. All coaches provided benefit (all the parameters of the multimember effect coach are positive), with Greg and Mike being the most effective.

Output 50.4.2: Parameter Estimates

Parameter Estimates
ParameterDFEstimateStandard
Error
t Value
Intercept10.3798730.5134310.74
coach Andy11.4443700.3180784.54
coach Bruna11.4460630.11017913.12
coach Elaine11.3122900.2818774.66
coach Greg13.0428280.11225627.11
coach Mike12.8407280.12116623.45
coach Tom11.2489460.11526610.84
practice 112.5389381.0157722.50
practice 213.8376841.1045573.47
practice 312.5747750.9308162.77
practice 41-0.0347470.717967-0.05
practice 500..
tPlay10.1394090.0230436.05


Suppose you want to examine regression diagnostics for the selected model. PROC GLMSELECT does not support such diagnostics, so you might want to use the REG procedure to produce these diagnostics. You can overcome the difficulty that PROC REG does not support CLASS and EFFECT statements by using the OUTDESIGN= option in the PROC GLMSELECT statement to obtain the design matrix that you can use as an input data set for further analysis with other SAS procedures.

The following statements use PROC PRINT to produce Output 50.4.3, which shows the first five observations of the design matrix designCamp.

proc print data=designCamp(obs=5);
run;

Output 50.4.3: First Five Observations of the designCamp Data Set

ObsInterceptcoach_Andycoach_Brunacoach_Elainecoach_Gregcoach_Mikecoach_TomtPlaypractice_1practice_2practice_3practice_4practice_5improvement
11000001190.000000.001360.050770.583440.364436
21000200330.206330.504130.250140.039400.0000014
31000020240.206330.504130.250140.039400.0000013
41000010280.206330.504130.250140.039400.0000011
51020000340.162280.492790.290880.054050.0000012


To facilitate specifying the columns of the design matrix corresponding to the selected model, you can use the macro variable named _GLSMOD that PROC GLMSELECT creates whenever you specify the OUTDESIGN= option. The following statements use PROC REG to produce a panel of regression diagnostics corresponding to the model selected by PROC GLMSELECT.

ods graphics on;

proc reg data=designCamp;
   model improvement = &_GLSMOD;
quit;

ods graphics off;

The regression diagnostics shown in Output 50.4.4 indicate a reasonable model. However, they also reveal the presence of one large outlier and several influential observations that you might want to investigate.

Output 50.4.4: Fit Diagnostics

Fit Diagnostics


Sometimes you might want to use subsets of the columns of the design matrix. In such cases, it might be convenient to produce a design matrix with generic names for the columns. You might also want a design matrix containing the columns corresponding to the full model that you specify in the MODEL statement. By default, the design matrix includes only the columns that correspond to effects in the selected model. The following statements show how to do this.

proc glmselect data=TennisCamp
     outdesign(fullmodel prefix=parm names)=designCampGeneric;
   class forehandCoach backhandCoach volleyCoach gender;

   effect coach    = mm(forehandCoach backhandCoach volleyCoach / noeffect
                         details weight=(tForehand tBackhand tVolley));
   effect practice = spline(tPractice/knotmethod=list(25) details);

   model improvement = coach practice tLessons tPlay age gender
                       inRating nPastCamps;
run;

The PREFIX=parm suboption of the OUTDESIGN= option specifies that columns in the design matrix be given the prefix parm with a trailing index. The NAMES suboption requests the table in Output 50.4.5 that associates descriptive labels with the names of columns in the design matrix. Finally, the FULLMODEL suboption specifies that the design matrix include columns corresponding to all effects specified in the MODEL statement.

Output 50.4.5: Descriptive Names of Design Matrix Columns

The GLMSELECT Procedure
Selected Model

Parameter Names
NameParameter
parm1Intercept
parm2coach Andy
parm3coach Bruna
parm4coach Elaine
parm5coach Greg
parm6coach Mike
parm7coach Tom
parm8practice 1
parm9practice 2
parm10practice 3
parm11practice 4
parm12practice 5
parm13tLessons
parm14tPlay
parm15age
parm16gender f
parm17gender m
parm18inRating
parm19nPastCamps


The following statements produce Output 50.4.6, displaying the first five observations of the designCampGeneric data set:

proc print data=designCampGeneric(obs=5);
run;

Output 50.4.6: First Five Observations of designCampGeneric Data Set

Obsparm1parm2parm3parm4parm5parm6parm7parm8parm9parm10parm11parm12parm13parm14parm15parm16parm17parm18parm19improvement
110000010.000000.001360.050770.583440.3644311913104406
210002000.206330.504130.250140.039400.00000233151048214
310000200.206330.504130.250140.039400.00000224150153013
410000100.206330.504130.250140.039400.00000128131048011
510200000.162280.492790.290880.054050.00000234161057012