The GENMOD Procedure

Example 45.2 Normal Regression, Log Link

(View the complete code for this example.)

Consider the following data, where x is an explanatory variable and y is the response variable. It appears that y varies nonlinearly with x and that the variance is approximately constant. A normal distribution with a log link function is chosen to model these data; that is, so that .

data nor;
   input x y;
   datalines;
0 5
0 7
0 9
1 7
1 10
1 8
2 11
2 9
3 16
3 13
3 14
4 25
4 24
5 34
5 32
5 30
;

The following SAS statements produce the analysis with the normal distribution and log link:

proc genmod data=nor;
   model y = x / dist = normal
                 link = log;
   output out       = Residuals
          pred      = Pred
          resraw    = Resraw
          reschi    = Reschi
          resdev    = Resdev
          stdreschi = Stdreschi
          stdresdev = Stdresdev
          reslik    = Reslik;
run;

The OUTPUT statement is specified to produce a data set that contains predicted values and residuals for each observation. This data set can be useful for further analysis, such as residual plotting.

The results from these statements are displayed in Output 45.2.1.

Output 45.2.1: Log-Linked Normal Regression

The GENMOD Procedure

Model Information
Data SetWORK.NOR
DistributionNormal
Link FunctionLog
Dependent Variabley

Criteria For Assessing Goodness Of Fit
CriterionDFValueValue/DF
Deviance1452.30003.7357
Scaled Deviance1416.00001.1429
Pearson Chi-Square1452.30003.7357
Scaled Pearson X21416.00001.1429
Log Likelihood -32.1783 
Full Log Likelihood -32.1783 
AIC (smaller is better) 70.3566 
AICC (smaller is better) 72.3566 
BIC (smaller is better) 72.6743 

Analysis Of Maximum Likelihood Parameter Estimates
ParameterDFEstimateStandard
Error
Wald 95% Confidence LimitsWald Chi-SquarePr > ChiSq
Intercept11.72140.08941.54611.8966370.76<.0001
x10.34960.02060.30910.3901286.64<.0001
Scale11.80800.31961.27862.5566  

Note:The scale parameter was estimated by maximum likelihood.



The PROC GENMOD scale parameter, in the case of the normal distribution, is the standard deviation. By default, the scale parameter is estimated by maximum likelihood. You can specify a fixed standard deviation by using the NOSCALE and SCALE= options in the MODEL statement.

proc print data=Residuals;
run;

Output 45.2.2: Data Set of Predicted Values and Residuals

ObsxyPredReschiResrawResdevStdreschiStdresdevReslik
1055.5921-0.59212-0.59212-0.59212-0.34036-0.34036-0.34036
2075.59211.407881.407881.407880.809280.809280.80928
3095.59213.407883.407883.407881.958921.958921.95892
4177.9324-0.93243-0.93243-0.93243-0.54093-0.54093-0.54093
51107.93242.067572.067572.067571.199471.199471.19947
6187.93240.067570.067570.067570.039200.039200.03920
721111.2522-0.25217-0.25217-0.25217-0.14686-0.14686-0.14686
82911.2522-2.25217-2.25217-2.25217-1.31166-1.31166-1.31166
931615.96120.038780.038780.038780.022490.022490.02249
1031315.9612-2.96122-2.96122-2.96122-1.71738-1.71738-1.71738
1131415.9612-1.96122-1.96122-1.96122-1.13743-1.13743-1.13743
1242522.64102.358972.358972.358971.372521.372521.37252
1342422.64101.358971.358971.358970.790690.790690.79069
1453432.11631.883661.883661.883661.229141.229141.22914
1553232.1163-0.11634-0.11634-0.11634-0.07592-0.07592-0.07592
1653032.1163-2.11634-2.11634-2.11634-1.38098-1.38098-1.38098


The data set of predicted values and residuals (Output 45.2.2) is created by the OUTPUT statement. You can use the PLOTS= option in the PROC GENMOD statement to create plots of predicted values and residuals. Note that raw, Pearson, and deviance residuals are equal in this example. This is a characteristic of the normal distribution and is not true in general for other distributions.