Topic 2: An Example
Leaning Tower of Pisa Construction began in 1173 and by 1178 (2 nd floor), it began to sink Construction resumed in To compensate for tilt, engineers built upper levels with one side taller Seventh floor completed in 1319 with bell tower added in 1372 Tilt continued to grow over time and was monitored. Closed in Stabilization completed in 2008 by removing ground from taller side
Leaning Tower of Pisa Response variable the lean (Y) –Lean in tenths of mm past 2.9 meters Explanatory variable year (X) Construct scatterplot –Can we use a line to describe relationship? Want to predict the future lean
SAS Data Step data a1; input year lean cards; ; data a1p; set a1; if lean ne.; run;
SAS Output Settings Version 9.3: all output is by default in HTML May prefer output in RTF or listing format to cut and paste in editor (e.g., Microsoft Word) ods html close; ods rtf file="H:\pisa.rtf"; ….SAS commands…. ods rtf close;
Proc Print proc print data=a1; run; Specify the data set to use Will print all variables if none are specified using var statement
Obsyearlean The data set arranged in columns. First row provides names for variables
Proc Gplot symbol1 v=circle i=sm70; proc gplot data=a1p; plot lean*year; run; symbol1 v=circle i=rl; proc gplot data=a1p; plot lean*year; run; Requests a smoothed curve be added to the plot Requests the least- squares regression line be added to the plot
Smoothed curve
Regression line
Proc Reg proc reg data=a1; model lean=year / clb p r; output out=a2 p=pred r=resid; id year; run;
Parameter Estimates VariableDF Parameter Estimate Standard Errort ValuePr > |t| 95% Confidence Limits Intercept year < Root MSE R-Square Dependent Mean Adj R-Sq Coeff Var
Output Statistics Obsyear Dependent Variable Predicted Value Std Error Mean PredictResidual Std Error Residual Student Residual Cook's D | |** | | *| | | | | | | | | *| | | |* | | |* | | **| | | | | | **| | | ***| | | | | | |**** |
Background Reading Appendix A. –A.3 : random variables –A.4 : probability distributions Chapter 1 –1.3 : simple linear regression –1.6 : estimation of regression function –1.7 : estimation of error variance –1.8 : normal error regression model