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 C1–C5. 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
| Parameter Estimates | |||||||
|---|---|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | Chi-Square | Pr > ChiSq | 95% Confidence Limits | |
| Intercept | 1 | 4.028096 | 0.454883 | 78.4153 | <.0001 | 3.13654 | 4.91965 |
| C1 0 | 1 | -0.064442 | 0.256719 | 0.0630 | 0.8018 | -0.56760 | 0.43872 |
| C1 1 | 1 | -1.308470 | 0.318002 | 16.9305 | <.0001 | -1.93174 | -0.68520 |
| C1 2 | 1 | 0.295802 | 0.257834 | 1.3162 | 0.2513 | -0.20954 | 0.80115 |
| C1 3 | 0 | 0 | . | . | . | . | . |
| C2 0 | 1 | 1.154556 | 0.295110 | 15.3060 | <.0001 | 0.57615 | 1.73296 |
| C2 1 | 1 | 0.824472 | 0.295273 | 7.7966 | 0.0052 | 0.24575 | 1.40320 |
| C2 2 | 1 | -0.287943 | 0.288421 | 0.9967 | 0.3181 | -0.85324 | 0.27735 |
| C2 3 | 0 | 0 | . | . | . | . | . |
| C3 0 | 1 | -0.008546 | 0.283509 | 0.0009 | 0.9760 | -0.56421 | 0.54712 |
| C3 1 | 1 | -0.319783 | 0.276053 | 1.3419 | 0.2467 | -0.86084 | 0.22127 |
| C3 2 | 1 | -0.071452 | 0.296418 | 0.0581 | 0.8095 | -0.65242 | 0.50952 |
| C3 3 | 0 | 0 | . | . | . | . | . |
| C4 0 | 1 | -0.143018 | 0.288101 | 0.2464 | 0.6196 | -0.70769 | 0.42165 |
| C4 1 | 1 | -0.219348 | 0.290441 | 0.5704 | 0.4501 | -0.78860 | 0.34991 |
| C4 2 | 1 | 0.091763 | 0.278635 | 0.1085 | 0.7419 | -0.45435 | 0.63788 |
| C4 3 | 0 | 0 | . | . | . | . | . |
| C5 0 | 1 | -1.227558 | 0.267605 | 21.0425 | <.0001 | -1.75205 | -0.70306 |
| C5 1 | 1 | -0.560699 | 0.252238 | 4.9413 | 0.0262 | -1.05508 | -0.06632 |
| C5 2 | 1 | -0.252965 | 0.259908 | 0.9473 | 0.3304 | -0.76238 | 0.25645 |
| C5 3 | 0 | 0 | . | . | . | . | . |
| Dispersion | 1 | 1.672305 | 0.238205 | 1.26494 | 2.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 C1–C5, 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 C1–C5. 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