EXST7015 Fall2011 Appendix 18

EXST7015 Fall2011 Appendix 18 - Statistical Techniques II...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 325 1 ****************************************************; 2 *** Example of Analysis of Covariance ***; 3 *** Steel and Torrie (1980) example (pg. 424) ***; 4 *** Analysis of three diet treatments on two ***; 5 *** sexes, where X is the initial weight, ***; 6 *** and Y is the weight gain in pounds. ***; 7 ****************************************************; 8 OPTIONS NOCENTER PS=256 LS=132 nodate nonumber; 9 DATA HOGS; INFILE CARDS MISSOVER; 10 Title1 'Analysis of Covariance example from Steel & Torrie, 1980'; 11 INPUT PEN SEX $ RATION $ X Y; 12 CARDS; NOTE: The data set WORK.HOGS has 30 observations and 5 variables. NOTE: DATA statement used: real time 0.05 seconds cpu time 0.05 seconds 12 ! RUN; 43 ; 44 PROC PRINT DATA=HOGS; Title2 'Raw data listing'; RUN; NOTE: There were 30 observations read from the data set WORK.HOGS. NOTE: The PROCEDURE PRINT printed page 1. NOTE: PROCEDURE PRINT used: real time 0.04 seconds cpu time 0.04 seconds Analysis of Covariance example from Steel & Torrie, 1980 Raw data listing Obs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 46 47 48 49 50 51 52 53 54 55 56 NOTE: NOTE: NOTE: NOTE: NOTE: 57 673 PEN 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 SEX M F M F M F M F M F M F M F M RATION a1 a1 a2 a2 a3 a3 a1 a1 a2 a2 a3 a3 a1 a1 a2 X 38 48 39 48 48 48 35 32 38 32 37 28 41 35 46 Y 9.52 9.94 8.51 10.00 9.11 9.75 8.21 9.48 9.95 9.24 8.50 8.66 9.32 9.32 8.43 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 F M F M F M F M F M F M F M F a2 a3 a3 a1 a1 a2 a2 a3 a3 a1 a1 a2 a2 a3 a3 41 42 33 48 46 40 46 42 50 43 32 40 37 40 30 9.34 8.90 7.63 10.56 10.90 8.86 9.68 9.51 10.37 10.42 8.82 9.20 9.67 8.76 8.57 PROC MIXED DATA=HOGS; CLASSES RATION SEX PEN; TITLE2 'Analysis of Covariance Example'; TITLE3 'Design done in PROC MIXED without a covariable'; MODEL Y = RATION|SEX / htype=1 3 DDFM=Satterthwaite; random PEN; LSMEANS RATION|SEX / ADJUST=TUKEY PDIFF; ods output diffs=ppp; ods output lsmeans=mmm; ods listing exclude diffs; ods listing exclude lsmeans; run; Convergence criteria met. The data set WORK.MMM has 11 observations and 8 variables. The data set WORK.PPP has 19 observations and 12 variables. The PROCEDURE MIXED printed page 2. PROCEDURE MIXED used: real time 0.22 seconds cpu time 0.22 seconds %include 'C:\SAS\pdmix800.sas'; %pdmix800(ppp,mmm,alpha=.05,sort=yes); James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 326 Analysis of Covariance example from Steel & Torrie, 1980 Design done in PROC MIXED without a covariable The Mixed Procedure Model Information Data Set WORK.HOGS Dependent Variable Y Covariance Structure Variance Components Estimation Method REML Residual Variance Method Profile Fixed Effects SE Method Model-Based Degrees of Freedom Method Satterthwaite Class RATION SEX PEN Class Level Information Levels Values 3 a1 a2 a3 2 F M 5 1 2 3 4 5 Dimensions Covariance Parameters Columns in X Columns in Z Subjects Max Obs Per Subject Observations Used Observations Not Used Total Observations Iteration 0 1 2 12 5 1 30 30 0 30 Iteration History Evaluations -2 Res Log Like 1 63.35598278 1 60.98295712 Convergence criteria met. Criterion 0.00000000 Covariance Parameter Estimates Cov Parm Estimate PEN 0.1329 Residual 0.4157 Fit Statistics -2 Res Log Likelihood AIC (smaller is better) AICC (smaller is better) BIC (smaller is better) 61.0 65.0 65.6 64.2 Type 1 Tests of Fixed Effects Num Den Effect DF DF F Value RATION 2 20 2.73 SEX 1 20 1.04 RATION*SEX 2 20 0.57 Pr > F 0.0896 0.3189 0.5730 Type 3 Tests of Fixed Effects Num Den Effect DF DF F Value RATION 2 20 2.73 SEX 1 20 1.04 RATION*SEX 2 20 0.57 Pr > F 0.0896 0.3189 0.5730 James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 327 Analysis of Covariance example from Steel & Torrie, 1980 Design done in PROC MIXED without a covariable Effect=RATION Obs 1 2 3 RATION a1 a2 a3 Effect=SEX Obs 4 5 Method=Tukey-Kramer(P<.05) SEX 677 678 679 680 681 682 683 684 685 686 NOTE: NOTE: NOTE: NOTE: NOTE: NOTE: 687 1303 Standard Error 0.2610 0.2610 0.2610 Method=Tukey-Kramer(P<.05) RATION SEX F M Effect=RATION*SEX Obs 6 7 8 9 10 11 Estimate 9.6490 9.2880 8.9760 RATION a1 a1 a2 a3 a2 a3 Estimate 9.4247 9.1840 Comparison Group=1 Estimate 9.6920 9.6060 9.5860 8.9960 8.9900 8.9560 MinSig Diff 0.72951 0.72951 0.72951 MaxSig Diff 0.72951 0.72951 0.72951 AvgSig Diff 0.72951 0.72951 0.72951 MaxSig Diff 0.49111 0.49111 AvgSig Diff 0.49111 0.49111 MaxSig Diff 1.28177 1.28177 1.28177 1.28177 1.28177 1.28177 AvgSig Diff 1.28177 1.28177 1.28177 1.28177 1.28177 1.28177 Comparison Group=2 Standard Error 0.2330 0.2330 Method=Tukey-Kramer(P<.05) SEX F M F F M M Letter Group A A A Standard Error 0.3312 0.3312 0.3312 0.3312 0.3312 0.3312 Letter Group A A MinSig Diff 0.49111 0.49111 Comparison Group=3 Letter Group A A A A A A MinSig Diff 1.28177 1.28177 1.28177 1.28177 1.28177 1.28177 PROC MIXED DATA=HOGS; CLASSES RATION SEX PEN; TITLE3 'Design done in PROC MIXED with a covariable'; MODEL Y = RATION|SEX X / htype=1 3 DDFM=Satterthwaite outp=ResidData; random PEN; LSMEANS RATION|SEX / ADJUST=TUKEY CL PDIFF; output diffs=ppp; output lsmeans=mmm; listing exclude diffs; listing exclude lsmeans; ods ods ods ods run; Convergence criteria met. The data set WORK.MMM has 11 observations and 11 variables. The data set WORK.PPP has 19 observations and 17 variables. The data set WORK.RESIDDATA has 30 observations and 12 variables. The PROCEDURE MIXED printed page 4. PROCEDURE MIXED used: real time 0.27 seconds cpu time 0.27 seconds %include 'C:\SAS\pdmix800.sas'; %pdmix800(ppp,mmm,alpha=.05,sort=yes); James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 328 Analysis of Covariance example from Steel & Torrie, 1980 Design done in PROC MIXED with a covariable The Mixed Procedure Model Information Data Set WORK.HOGS Dependent Variable Y Covariance Structure Variance Components Estimation Method REML Residual Variance Method Profile Fixed Effects SE Method Model-Based Degrees of Freedom Method Satterthwaite Class RATION SEX PEN Class Level Information Levels Values 3 a1 a2 a3 2 F M 5 1 2 3 4 5 Dimensions Covariance Parameters Columns in X Columns in Z Subjects Max Obs Per Subject Observations Used Observations Not Used Total Observations Iteration 0 1 2 3 2 13 5 1 30 30 0 30 Iteration History Evaluations -2 Res Log Like 1 55.08910489 3 53.38841782 1 53.38752175 1 53.38752024 Convergence criteria met. Criterion 0.00015698 0.00000027 0.00000000 Covariance Parameter Estimates Cov Parm Estimate PEN 0.06595 Residual 0.2504 Fit Statistics -2 Res Log Likelihood AIC (smaller is better) AICC (smaller is better) BIC (smaller is better) 53.4 57.4 58.0 56.6 Type 1 Tests Num Effect DF RATION 2 SEX 1 RATION*SEX 2 X 1 of Fixed Effects Den DF F Value 19.4 4.53 19.4 1.74 19.4 0.95 18.3 17.72 Pr > F 0.0243 0.2031 0.4037 0.0005 Type 3 Tests Num Effect DF RATION 2 SEX 1 RATION*SEX 2 X 1 of Fixed Effects Den DF F Value 19.5 4.65 20 4.76 19.6 0.23 18.3 17.72 Pr > F 0.0224 0.0413 0.7935 0.0005 James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 329 Analysis of Covariance example from Steel & Torrie, 1980 Design done in PROC MIXED with a covariable Effect=RATION Obs 1 2 3 Method=Tukey-Kramer(P<.05) Comparison Group=1 Standard Letter MinSig SEX Estimate Error Group Diff 9.6733 0.1956 A 0.56727 9.2395 0.1959 AB 0.56727 9.0003 0.1956 B 0.56727 MaxSig Diff 0.56896 0.56896 0.56896 AvgSig Diff 0.5684 0.5684 0.5684 Method=Tukey-Kramer(P<.05) Comparison Group=2 Standard Letter MinSig RATION SEX Estimate Error Group Diff F 9.5083 0.1740 A 0.39002 M 9.1004 0.1740 B 0.39002 MaxSig Diff 0.39002 0.39002 AvgSig Diff 0.39002 0.39002 MaxSig Diff 1.02295 1.02295 1.02295 1.02295 1.02295 1.02295 AvgSig Diff 1.00275 1.00275 1.00275 1.00275 1.00275 1.00275 RATION a1 a2 a3 Effect=SEX Obs 4 5 Effect=RATION*SEX Obs 6 7 8 9 10 11 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 NOTE: NOTE: NOTE: NOTE: NOTE: 1317 1933 RATION a1 a1 a2 a3 a2 a3 Method=Tukey-Kramer(P<.05) Standard SEX Estimate Error F 9.8134 0.2532 M 9.5332 0.2521 F 9.5294 0.2519 F 9.1821 0.2554 M 8.9495 0.2517 M 8.8185 0.2536 Comparison Group=3 Letter MinSig Group Diff A 0.99411 A 0.99411 A 0.99411 A 0.99411 A 0.99411 A 0.99411 PROC MIXED DATA=HOGS; CLASSES RATION SEX PEN; TITLE3 'Design with Covariable and interaction'; MODEL Y = RATION|SEX|X / htype=1 3 DDFM=Satterthwaite; random PEN; LSMEANS RATION|SEX / ADJUST=TUKEY PDIFF; ods output diffs=ppp; ods output lsmeans=mmm; ods listing exclude diffs; ods listing exclude lsmeans; run; Convergence criteria met. The data set WORK.MMM has 11 observations and 8 variables. The data set WORK.PPP has 19 observations and 12 variables. The PROCEDURE MIXED printed page 6. PROCEDURE MIXED used: real time 0.23 seconds cpu time 0.23 seconds %include 'C:\SAS\pdmix800.sas'; %pdmix800(ppp,mmm,alpha=.05,sort=yes); Analysis of Covariance example from Steel & Torrie, 1980 Design with Covariable and interaction The Mixed Procedure Model Information Data Set WORK.HOGS Dependent Variable Y Covariance Structure Variance Components Estimation Method REML Residual Variance Method Profile Fixed Effects SE Method Model-Based Degrees of Freedom Method Satterthwaite James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Class RATION SEX PEN SAS Examples Page 330 Class Level Information Levels Values 3 a1 a2 a3 2 F M 5 1 2 3 4 5 Dimensions Covariance Parameters Columns in X Columns in Z Subjects Max Obs Per Subject Observations Used Observations Not Used Total Observations Iteration 0 1 Appendix 18 2 24 5 1 30 30 0 30 Iteration History Evaluations -2 Res Log Like 1 64.31392830 2 64.21605896 Convergence criteria met. Criterion 0.00000001 Covariance Parameter Estimates Cov Parm Estimate PEN 0.01370 Residual 0.2281 Fit Statistics -2 Res Log Likelihood AIC (smaller is better) AICC (smaller is better) BIC (smaller is better) 64.2 68.2 69.0 67.4 Type 1 Tests of Fixed Effects Num Den Effect DF DF F Value RATION 2 14.2 4.97 SEX 1 14.2 1.90 RATION*SEX 2 14.2 1.04 X 1 8.89 23.41 X*RATION 2 15.2 2.71 X*SEX 1 16.6 0.00 X*RATION*SEX 2 17.2 2.76 Pr > F 0.0231 0.1890 0.3778 0.0010 0.0987 0.9973 0.0910 Type 3 Tests of Fixed Effects Num Den Effect DF DF F Value RATION 2 16.9 4.30 SEX 1 17 0.20 RATION*SEX 2 17.1 2.60 X 1 14 6.88 X*RATION 2 16.9 4.89 X*SEX 1 17.1 0.49 X*RATION*SEX 2 17.1 2.76 Pr > F 0.0309 0.6633 0.1030 0.0201 0.0211 0.4917 0.0912 James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 331 Analysis of Covariance example from Steel & Torrie, 1980 Design with Covariable and interaction Effect=RATION Obs 1 2 3 Method=Tukey-Kramer(P<.05) Letter Group MinSig Diff MaxSig Diff AvgSig Diff A AB B 0.5666 0.5666 0.5666 0.58313 0.58313 0.58313 0.57652 0.57652 0.57652 Method=Tukey-Kramer(P<.05) Comparison Group=2 Standard Letter MinSig RATION SEX Estimate Error Group Diff F 9.5240 0.1364 A 0.38597 M 9.1149 0.1398 B 0.38597 MaxSig Diff 0.38597 0.38597 AvgSig Diff 0.38597 0.38597 MaxSig Diff 1.05136 1.05136 1.05136 1.05136 1.05136 1.05136 AvgSig Diff 1.01377 1.01377 1.01377 1.01377 1.01377 1.01377 RATION a1 a2 a3 Standard Error 9.6343 9.3017 9.0224 SEX Estimate Comparison Group=1 0.1631 0.1616 0.1699 Effect=SEX Obs 4 5 Effect=RATION*SEX Obs 6 7 8 9 10 11 RATION a1 a2 a1 a3 a2 a3 Method=Tukey-Kramer(P<.05) SEX F F M F M M Estimate 9.8162 9.5582 9.4523 9.1977 9.0453 8.8471 Standard Error 0.2249 0.2215 0.2244 0.2265 0.2234 0.2430 Comparison Group=3 Letter Group A A A A A A MinSig Diff 0.99037 0.99037 0.99037 0.99037 0.99037 0.99037 1936 PROC UNIVARIATE DATA=ResidData PLOT NORMAL; VAR resid; 1937 TITLE4 'Residual analysis with PROC UNIVARIATE'; 1938 RUN; NOTE: The PROCEDURE UNIVARIATE printed page 8. NOTE: PROCEDURE UNIVARIATE used: real time 0.03 seconds cpu time 0.03 seconds 1938 ! QUIT; Analysis of Covariance example from Steel & Torrie, 1980 Design with Covariable and interaction Residual analysis with PROC UNIVARIATE The UNIVARIATE Procedure Variable: Resid N Mean Std Deviation Skewness Uncorrected SS Coeff Variation Moments 30 Sum Weights 0 Sum Observations 0.42337753 Variance -0.3066408 Kurtosis 5.19820755 Corrected SS . Std Error Mean 30 0 0.17924854 0.85642548 5.19820755 0.07729781 James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 Basic Statistical Measures Location Variability Mean 0.000000 Std Deviation Median 0.075839 Variance Mode . Range Interquartile Range SAS Examples Page 332 0.42338 0.17925 2.08092 0.45165 Tests for Location: Mu0=0 Test -Statistic-----p Value-----Student's t t 0 Pr > |t| 1.0000 Sign M 2 Pr >= |M| 0.5847 Signed Rank S 13.5 Pr >= |S| 0.7865 Test Shapiro-Wilk Kolmogorov-Smirnov Cramer-von Mises Anderson-Darling Tests for Normality --Statistic--W 0.966774 D 0.102691 W-Sq 0.081279 A-Sq 0.482075 -----p Value-----Pr < W 0.4551 Pr > D >0.1500 Pr > W-Sq 0.1992 Pr > A-Sq 0.2222 Quantiles (Definition 5) Quantile Estimate 100% Max 1.0338795 99% 1.0338795 95% 0.5379804 90% 0.4190551 75% Q3 0.2331595 50% Median 25% Q1 10% 5% 1% 0% Min 0.0758394 -0.2184919 -0.5928696 -0.7237573 -1.0470438 -1.0470438 Extreme Observations ------Lowest-----------Highest----Value Obs Value Obs -1.047044 7 0.320395 12 -0.723757 15 0.383313 23 -0.704528 18 0.454798 20 -0.481212 22 0.537980 25 -0.452238 26 1.033880 9 Stem 10 8 6 4 2 0 -0 -2 -4 -6 -8 -10 Leaf 3 # 1 Boxplot 0 54 03338928 169499 641 84220 85 20 2 8 6 3 5 2 2 | +-----+ *--+--* | | +-----+ | | 5 1 ----+----+----+----+ Multiply Stem.Leaf by 10**-1 1941 1942 1943 0 Normal Probability Plot 1.1+ * ++ | +++++ | ++++ | ++++* * | ******* * | *****+ | ***+ | ***** | ++*+* | ++*+* | +++++ -1.1+++ * +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 PROC MEANS DATA=HOGS; VAR X Y; TITLE2 'Raw means'; RUN; Analysis of Covariance example from Steel & Torrie, 1980 Raw means The MEANS Procedure Variable N Mean Std Dev Minimum X 30 40.1000000 6.1831250 28.0000000 Y 30 9.3043333 0.7507545 7.6300000 Maximum 50.0000000 10.9000000 James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 333 1941 DATA TWO; SET HOGS; IF RATION = 'a1' THEN A = Y; 1942 IF RATION = 'a2' THEN B = Y; 1943 IF RATION = 'a3' THEN C = Y; RUN; NOTE: There were 30 observations read from the data set WORK.HOGS. NOTE: The data set WORK.TWO has 30 observations and 8 variables. NOTE: DATA statement used: real time 0.02 seconds cpu time 0.02 seconds 1944 GOPTIONS DEVICE=cgm GSFMODE=REPLACE GSFNAME=OUT1 NOPROMPT noROTATE; 1945 1946 FILENAME OUT1 'C:\SAS\25s-AnCova&Design1.cgm'; 1947 PROC GPLOT DATA=TWO; 1948 TITLE1 F=SWISS H=1 'Multisource Regression Example'; 1949 TITLE2 F=SWISS H=1 'Separate slopes and intercepts'; 1950 PLOT A*X B*X C*X / OVERLAY HAXIS=AXIS1 VAXIS=AXIS2; 1951 AXIS1 LABEL=(F=SWISS H=1 'Initial weight (pounds)') WIDTH=5 MINOR=(N=4) 1952 VALUE=(F=SWISS H=1) ORDER=0 TO 60 BY 10; 1953 AXIS2 LABEL=(F=SWISS H=1 'Weight gain (pounds)') WIDTH=6 1954 VALUE=(F=SWISS H=1) MINOR=(N=5) ORDER=6 TO 12 BY 2; 1955 SYMBOL1 C=red V=J I=RL L=1 W=2 H=1 F=SPECIAL MODE=INCLUDE; 1956 SYMBOL2 C=blue V=K I=RL L=1 W=2 H=1 F=SPECIAL MODE=INCLUDE; 1957 SYMBOL3 C=green V=L I=RL L=1 W=2 H=1 F=SPECIAL MODE=INCLUDE; RUN; WARNING: The axis frame outline was drawn with line width 6 as specified on the left vertical axis. Any other axis line widths were ignored. NOTE: Regression equation : A = 5.598712 + 0.101766*X. NOTE: 20 observation(s) contained a MISSING value for the A * X request. NOTE: Regression equation : B = 8.969529 + 0.007825*X. NOTE: 20 observation(s) contained a MISSING value for the B * X request. NOTE: Regression equation : C = 5.953836 + 0.075934*X. NOTE: 20 observation(s) contained a MISSING value for the C * X request. NOTE: 26 RECORDS WRITTEN TO C:\SAS\25s-AnCova&Design1.cgm Weight gain (pounds) 12 Multisource Regression Example Separate slopes and intercepts 10 8 6 20 30 40 50 Initial weight (pounds) Which treatment is "higher"? 60 Where would you compare the lines? James P. Geaghan - Copyright 2011 Statistical Techniques II Analysis of Covariance (revisited) Appendix 18 SAS Examples Page 334 1959 GOPTIONS GSFNAME=OUT2; FILENAME OUT2 'C:\SAS\25s-AnCova&Design2.cgm'; NOTE: There were 30 observations read from the data set WORK.TWO. NOTE: PROCEDURE GPLOT used: real time 0.19 seconds cpu time 0.12 seconds 1960 PROC GPLOT DATA=TWO; 1961 TITLE1 F=SWISS H=1 'Multisource Regression Example'; 1962 TITLE2 F=SWISS H=1 'Single line with confidence intervals (99% cli)'; 1963 PLOT Y*X / OVERLAY HAXIS=AXIS1 VAXIS=AXIS2; 1964 AXIS1 LABEL=(F=SWISS H=1 'Initial weight (pounds)') WIDTH=5 MINOR=(N=4) 1965 VALUE=(F=SWISS H=1) ORDER=0 TO 60 BY 10; 1966 AXIS2 LABEL=(F=SWISS H=1 'Weight gain (pounds)') WIDTH=6 1967 VALUE=(F=SWISS H=1) MINOR=(N=5) ORDER=6 TO 12 BY 2; 1968 SYMBOL1 C=red V=J I=RLcli99 L=1 W=2 F=SPECIAL H=1 MODE=INCLUDE; 1969 RUN; WARNING: The axis frame outline was drawn with line width 6 as specified on the left vertical axis. Any other axis line widths were ignored. NOTE: Regression equation : Y = 6.464854 + 0.07081*X. NOTE: 94 RECORDS WRITTEN TO C:\SAS\25s-AnCova&Design1.cgm 1970 NOTE: There were 30 observations read from the data set WORK.TWO. NOTE: PROCEDURE GPLOT used: real time 0.11 seconds cpu time 0.05 seconds Weight gain (pounds) 12 Multisource Regression Example Three slopes through LSMeans 10 8 6 20 Confidence intervals (99% cli for single line) 30 40 50 Initial weight (pounds) 60 James P. Geaghan - Copyright 2011 ...
View Full Document

Ask a homework question - tutors are online