The GENSELECT Procedure

Example 7.2 Gamma Model

The following statements examine the data set getStarted, which is used in the section Getting Started: GENSELECT Procedure, but they request that a log-linked gamma model be fit by using the continuous variable Total as the response instead of the count variable Y. The following statements fit a log-linked gamma model to these data by using classification effects for the variables C1C5. The CLB MODEL statement option requests that 95% confidence limits be computed and displayed along with the parameter estimates. The CODE statement requests that a text file named "Scoring Parameters.txt" be created. This file contains a SAS program that has information from the model that allows scoring of a new data set based on the parameter estimates from the current model.

proc genselect data=mycas.getStarted;
   class C1-C5;
   model Total = C1-C5 / Distribution=Gamma Link=Log CLB;
   code File='ScoringParameters.txt';
run;

The "Parameter Estimates" table in Output 7.2.1 shows the resulting regression model parameter estimates and the estimated gamma dispersion parameter.

Output 7.2.1: Parameter Estimates

The GENSELECT Procedure

Parameter Estimates
ParameterDFEstimateStandard
Error
Chi-SquarePr > ChiSq95% Confidence Limits
Intercept14.0280960.45488378.4153<.00013.136544.91965
C1 01-0.0644420.2567190.06300.8018-0.567600.43872
C1 11-1.3084700.31800216.9305<.0001-1.93174-0.68520
C1 210.2958020.2578341.31620.2513-0.209540.80115
C1 300.....
C2 011.1545560.29511015.3060<.00010.576151.73296
C2 110.8244720.2952737.79660.00520.245751.40320
C2 21-0.2879430.2884210.99670.3181-0.853240.27735
C2 300.....
C3 01-0.0085460.2835090.00090.9760-0.564210.54712
C3 11-0.3197830.2760531.34190.2467-0.860840.22127
C3 21-0.0714520.2964180.05810.8095-0.652420.50952
C3 300.....
C4 01-0.1430180.2881010.24640.6196-0.707690.42165
C4 11-0.2193480.2904410.57040.4501-0.788600.34991
C4 210.0917630.2786350.10850.7419-0.454350.63788
C4 300.....
C5 01-1.2275580.26760521.0425<.0001-1.75205-0.70306
C5 11-0.5606990.2522384.94130.0262-1.05508-0.06632
C5 21-0.2529650.2599080.94730.3304-0.762380.25645
C5 300.....
Dispersion11.6723050.238205  1.264942.21086


Now suppose you want to compute predicted values for some different data. If is a vector of explanatory variables that might not be in the original data and is the vector of estimated regression parameters from the model, then is the predicted value of the mean, where g is the log link function in this case.

The following data contain new values of the regression variables C1C5, from which you can compute predicted values based on information in the SAS program that is created by the CODE statement. This is called scoring the new data set.

data ScoringData;
   input C1-C5;
   datalines;
3 3 1 0 2
1 1 2 2 0
3 2 2 2 0
1 1 2 3 2
1 1 2 3 3
3 1 1 0 1
0 2 1 0 0
2 1 3 1 3
3 2 3 2 0
3 0 2 0 1
;

The following SAS DATA step creates the new data set Scores, which contains a variable P_Total that represents the predicted values of Total, along with the variables C1C5. The resulting data are shown in Output 7.2.2.

data Scores;
   set ScoringData;
   %inc 'ScoringParameters.txt';
run;
proc print data=Scores;
run;

Output 7.2.2: Predicted Values for Scoring Data

ObsC1C2C3C4C5P_Total
13310227.449
21122010.349
33222012.590
41123225.020
51123332.222
63110146.020
7021007.282
821313138.244
93232013.523
103020182.063


Last updated: December 21, 2018