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 seawater 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.
proc sgscatter data=iron; plot loss*fe; run; ods graphics off;
The plot in Figure 46.4 displays a strong negative relationship between iron content and corrosion resistance, but it is not clear whether there is curvature in this relationship.
Figure 46.4: Plot of Observed Corrosion Resistance by Iron Content
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 46.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.
Figure 46.5: Data Information
Figure 46.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.
Figure 46.6: ANOVA Table
The R square 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 F 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 46.7 contains tests of effects and parameter estimates. The latter are displayed by default when the model contains only continuous variables.
Figure 46.7: Tests of Effects and Parameter Estimates
The t tests provided are equivalent to the Type III F tests. The quadratic term is not significant (p = 0.6107) 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 ODS Graphics is enabled, PROC GLM also displays by default a scatter plot of the original data, as in Figure 46.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 46.8.
ods graphics on; proc glm data=iron; model loss=fe fe*fe; run; ods graphics off;
Figure 46.8: Plot of Observed and Fit Corrosion Resistance by Iron Content, Quadratic Model
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 46.9 displays the output produced by these statements. The linear term is still significant . The estimated model is now
Figure 46.9: Linear Model Output