Polynomial Regression Using SAS /*Read in the SPSS portable file using Proc Convert*/ filename file1 "d:\510\2007\data\htwt.por"; proc convert spss=file1 out=htwt; run; options pageno=1; OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; title; proc contents data=htwt; run; Data Set Name Member Type Engine Created Last Modified Protection Data Set Type Label Data Representation Encoding The CONTENTS Procedure WORK.HTWT DATA V9 Monday, February 05, 2007 04:41:38 PM Monday, February 05, 2007 04:41:38 PM Observations Variables Indexes Observation Length Deleted Observations Compressed Sorted WINDOWS_32 wlatin1 Western (Windows) Engine/Host Dependent Information Data Set Page Size 4096 Number of Data Set Pages 3 First Data Page 1 Max Obs per Page 126 Obs in First Data Page 83 Number of Data Set Repairs 0 File Name c:\temp\_TD2040\htwt.sas7bdat Release Created 9.0101M2 Host Created XP_PRO Alphabetic List of Variables and Attributes # 2 3 1 4 Variable AGE HEIGHT SEX WEIGHT Type Num Num Char Num Len 8 8 8 8 Format 5.2 5.2 8. 6.2 1 237 4 0 32 0 NO NO proc means data=htwt; run; The MEANS Procedure Variable N Mean Std Dev Minimum Maximum ------------------------------------------------------------------------------AGE 237 16.4430380 1.8425767 13.9000000 25.0000000 HEIGHT 237 61.3645570 3.9454019 50.5000000 72.0000000 WEIGHT 237 101.3080169 19.4406980 50.5000000 171.5000000 ------------------------------------------------------------------------------- goptions reset=all; goptions device=win target=winprtm; symbol1 color=black value=dot height=.5 interpol=rq; title "Scatter Plot with Quadratic Regression Line"; proc gplot data=htwt; where age < 20; plot height * age ; run; /*Data Step to Create Age-Squared, Centered Age, and Centered Age-Squared*/ data htwt2; set htwt; agesq = age*age; centage = age - 16.3; centagesq = centage*centage; run; title "Regression Model with Original Age and Age-Squared Variables"; proc reg data=htwt2; 2 where age < 20; model height = age agesq; plot rstudent.*predicted.; output out=regdata1 p=predict r=resid rstudent=rstudent; run; quit; Regression Model with Original Age and Age-Squared Variables The REG Procedure Model: MODEL1 Dependent Variable: HEIGHT Number of Observations Read Number of Observations Used Source Model Error Corrected Total DF 2 227 229 Root MSE Dependent Mean Coeff Var Variable Intercept AGE agesq DF 1 1 1 230 230 Analysis of Variance Sum of Mean Squares Square 1436.79524 718.39762 1940.95820 8.55048 3377.75343 2.92412 61.18739 4.77896 R-Square Adj R-Sq Parameter Estimates Parameter Standard Estimate Error -31.22120 22.20249 9.83820 2.70952 -0.25318 0.08199 F Value 84.02 0.4254 0.4203 t Value -1.41 3.63 -3.09 3 Pr > F <.0001 Pr > |t| 0.1610 0.0003 0.0023 proc univariate data=regdata1; var rstudent; histogram; qqplot / normal(mu=est sigma=est); run; title "Regression Model with Centered Age and Age-Squared Variables"; proc reg data=htwt2; where age < 20; model height = centage centagesq; run; quit; The REG Procedure Model: MODEL1 Dependent Variable: HEIGHT Number of Observations Read Number of Observations Used 230 230 Analysis of Variance DF 2 227 229 Sum of Squares 1436.79524 1940.95820 3377.75343 Root MSE Dependent Mean Coeff Var 2.92412 61.18739 4.77896 Source Model Error Corrected Total Variable Intercept centage centagesq DF 1 1 1 Mean Square 718.39762 8.55048 R-Square Adj R-Sq Parameter Estimates Parameter Standard Estimate Error 61.87284 0.29323 1.58438 0.12233 -0.25318 0.08199 F Value 84.02 0.4254 0.4203 t Value 211.00 12.95 -3.09 4 Pr > F <.0001 Pr > |t| <.0001 <.0001 0.0023