The GLM Procedure |
PROC GLM for Quadratic Least Squares Regression |
In polynomial regression, the values of a dependent variable (also called a response variable) are described or predicted in terms of polynomial terms involving one or more independent or explanatory variables. An example of quadratic regression in PROC GLM follows. These data are taken from Draper and Smith (1966, p. 57). Thirteen specimens of 90/10 Cu-Ni alloys are tested in a corrosion-wheel setup in order to examine corrosion. Each specimen has a certain iron content. The wheel is rotated in salt sea water at 30 ft/sec for 60 days. Weight loss is used to quantify the corrosion. The fe variable represents the iron content, and the loss variable denotes the weight loss in milligrams/square decimeter/day in the following DATA step.
title 'Regression in PROC GLM'; data iron; input fe loss @@; datalines; 0.01 127.6 0.48 124.0 0.71 110.8 0.95 103.9 1.19 101.5 0.01 130.1 0.48 122.0 1.44 92.3 0.71 113.1 1.96 83.7 0.01 128.0 1.44 91.4 1.96 86.2 ;
The SGSCATTER procedure is used in the following statements to request a scatter plot of the response variable versus the independent variable.
ods graphics on; proc sgscatter data=iron; plot loss*fe; run; ods graphics off;
The plot in Figure 39.4 displays a strong negative relationship between iron content and corrosion resistance, but it is not clear whether there is curvature in this relationship.
The following statements fit a quadratic regression model to the data. This enables you to estimate the linear relationship between iron content and corrosion resistance and to test for the presence of a quadratic component. The intercept is automatically fit unless the NOINT option is specified.
proc glm data=iron; model loss=fe fe*fe; run;
The CLASS statement is omitted because a regression line is being fitted. Unlike PROC REG, PROC GLM allows polynomial terms in the MODEL statement.
PROC GLM first displays preliminary information, shown in Figure 39.5, telling you that the GLM procedure has been invoked and stating the number of observations in the data set. If the model involves classification variables, they are also listed here, along with their levels.
Number of Observations Read | 13 |
---|---|
Number of Observations Used | 13 |
Figure 39.6 shows the overall ANOVA table and some simple statistics. The degrees of freedom can be used to check that the model is correct and that the data have been read correctly. The Model degrees of freedom for a regression is the number of parameters in the model minus 1. You are fitting a model with three parameters in this case,
so the degrees of freedom are . The Corrected Total degrees of freedom are always one less than the number of observations used in the analysis.
Source | DF | Sum of Squares | Mean Square | F Value | Pr > F |
---|---|---|---|---|---|
Model | 2 | 3296.530589 | 1648.265295 | 164.68 | <.0001 |
Error | 10 | 100.086334 | 10.008633 | ||
Corrected Total | 12 | 3396.616923 |
The indicates that the model accounts for 97% of the variation in LOSS. The coefficient of variation (Coeff Var), Root MSE (Mean Square for Error), and mean of the dependent variable are also listed.
The overall test is significant , indicating that the model as a whole accounts for a significant amount of the variation in LOSS. Thus, it is appropriate to proceed to testing the effects.
Figure 39.7 contains tests of effects and parameter estimates. The latter are displayed by default when the model contains only continuous variables.
The tests provided are equivalent to the Type III tests. The quadratic term is not significant and thus can be removed from the model; the linear term is significant . This suggests that there is indeed a straight-line relationship between loss and fe.
Finally, if you enable ODS Graphics, PROC GLM also displays by default a scatter plot of the original data, as in Figure 39.4, with the quadratic fit overlaid. The following statements, which are the same as the previous analysis but with ODS Graphics enabled, additionally produce Figure 39.8.
ods graphics on; proc glm data=iron; model loss=fe fe*fe; run; ods graphics off;
The insignificance of the quadratic term in the model is reflected in the fact that the fit is nearly linear.
Fitting the model without the quadratic term provides more accurate estimates for and . PROC GLM allows only one MODEL statement per invocation of the procedure, so the PROC GLM statement must be issued again. The following statements are used to fit the linear model.
proc glm data=iron; model loss=fe; run;
Figure 39.9 displays the output produced by these statements. The linear term is still significant . The estimated model is now
Source | DF | Sum of Squares | Mean Square | F Value | Pr > F |
---|---|---|---|---|---|
Model | 1 | 3293.766690 | 3293.766690 | 352.27 | <.0001 |
Error | 11 | 102.850233 | 9.350021 | ||
Corrected Total | 12 | 3396.616923 |
Parameter | Estimate | Standard Error | t Value | Pr > |t| |
---|---|---|---|---|
Intercept | 129.7865993 | 1.40273671 | 92.52 | <.0001 |
fe | -24.0198934 | 1.27976715 | -18.77 | <.0001 |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.