EXST7005 Fall2010 21b Appendix 06

EXST7005 Fall2010 21b Appendix 06 - Statistical Methods I...

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 Methods I (EXST 7005) Appendix 6 Page 208 1 TITLE1 'Factorial ANOVA (CRD with factorial treatment arrangement)'; 2 dm'log;clear;output;clear'; 3 4 ODS HTML style=minimal body='C:\EXST 7005\SAS\Example06.html' ; NOTE: Writing HTML Body file: C:\EXST 7005\SAS\Example06.html 5 ODS RTF style=minimal body='C:\EXST 7005\SAS\Example06.rtf'; NOTE: Writing RTF Body file: C:\EXST 7005\SAS\Example06.rtf 6 ODS PDF style=minimal body='C:\EXST 7005\SAS\Example06.PDF'; NOTE: Writing ODS PDF output to DISK destination "C:\EXST 7005\SAS\Example06.PDF", printer "PDF". 7 8 9 10 11 12 13 14 15 *******************************************************************; *** Neter, Kutner, Nachtsheim, Wasserman (1996) [CH19PR18.sas] ***; *** Kidney failure patients on dialysis. Amount of dialysis ***; *** needed depends on duration of treatment and weight gain ***; *** from fluid retention In this study the effect of these two ***; *** facters was to be evaluated by examining the number of ***; *** days of hospitalization during the year. ***; *******************************************************************; 16 options ps=256 ls=99 nocenter nodate nonumber nolabel; 17 18 19 data kidney; infile cards missover; 20 TITLE2 'Analysis of duration of patients stay in hospital'; 21 LABEL days = 'Days in hospital during year'; 22 LABEL duration = 'Duration of disease'; 23 LABEL wtgain = 'Wt gain between visits (fluid retention)'; 24 LABEL rep = 'Patient'; 25 input days d w rep; 26 wtgain = 'Moderate'; 27 if w = 1 then wtgain = 'Mild'; 28 if w = 3 then wtgain = 'Severe'; 29 duration = 'Short'; 30 if d = 2 then duration = 'Long'; 31 cards; NOTE: The data set WORK.KIDNEY has 60 observations and 6 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 31 ! run; 92 ; 93 PROC PRINT DATA=kidney; TITLE3 'LISTING OF DATA'; RUN; NOTE: There were 60 observations read from the data set WORK.KIDNEY. NOTE: The PROCEDURE PRINT printed page 1. NOTE: PROCEDURE PRINT used (Total process time): real time 0.10 seconds cpu time 0.03 seconds Factorial ANOVA (CRD with factorial treatment arrangement) Analysis of duration of patients stay in hospital LISTING OF DATA Obs 1 2 3 4 5 6 7 8 9 10 11 12 13 days 0 2 1 3 0 2 0 5 6 8 2 4 7 duration Short Short Short Short Short Short Short Short Short Short Short Short Short wtgain Mild Mild Mild Mild Mild Mild Mild Mild Mild Mild Moderate Moderate Moderate rep 1 2 3 4 5 6 7 8 9 10 1 2 3 d 1 1 1 1 1 1 1 1 1 1 1 1 1 w 1 1 1 1 1 1 1 1 1 1 2 2 2 14 15 16 17 18 19 20 21 22 23 24 25 26 27 12 15 4 3 1 5 20 15 10 8 5 25 16 7 Short Short Short Short Short Short Short Short Short Short Short Short Short Short Moderate Moderate Moderate Moderate Moderate Moderate Moderate Severe Severe Severe Severe Severe Severe Severe 4 5 6 7 8 9 10 1 2 3 4 5 6 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 James P. Geaghan Copyright 2010 Statistical Methods I (EXST 7005) 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 30 3 27 0 1 1 0 4 2 7 4 0 3 5 3 2 0 94 95 96 97 98 99 100 101 NOTE: NOTE: NOTE: NOTE: NOTE: Short Short Short Long Long Long Long Long Long Long Long Long Long Long Long Long Long Severe Severe Severe Mild Mild Mild Mild Mild Mild Mild Mild Mild Mild Moderate Moderate Moderate Moderate 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Appendix 6 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 Page 209 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 1 1 3 6 7 9 10 8 12 3 7 15 4 9 6 1 Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Moderate Moderate Moderate Moderate Moderate Moderate Severe Severe Severe Severe Severe Severe Severe Severe Severe Severe 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 PROC MIXED DATA=kidney; CLASS WTGAIN DURATION; TITLE3 'Analysis of Variance done with PROC MIXED'; MODEL DAYS = WTGAIN DURATION WTGAIN*DURATION / HType=3 ddfm=satterth outp=resids; LSMEANS WTGAIN DURATION WTGAIN*DURATION / PDIFF ADJUST=TUKEY; ods output diffs=ppp lsmeans=mmm; **ods listing exclude diffs lsmeans; *this is now just a comment; run; The data set WORK.MMM has 11 observations and 8 variables. The data set WORK.PPP has 19 observations and 12 variables. The data set WORK.RESIDS has 60 observations and 13 variables. The PROCEDURE MIXED printed page 2. PROCEDURE MIXED used (Total process time): real time 0.20 seconds cpu time 0.12 seconds TITLE4 'Post hoc adjustment with macro by Arnold Saxton'; * SAS Macro by Arnold Saxton: Saxton, A.M. 1998. A macro for; 102 103 104 * converting mean separation output to letter groupings in Proc Mixed.; 105 * In Proc. 23rd SAS Users Group Intl., SAS Inst, Cary, NC, pp1243-1246.; 106 %include 'C:\Geaghan\EXST\EXST7005New\Fall2003\SaS\pdmix800.sas'; 734 %pdmix800(ppp,mmm,alpha=.01,sort=yes); PDMIX800 03.26.2002 processing 4.3008418397 Tukey values for wtgain are 5.17691 (avg) 5.17691 (min) 5.17691 (max). 3.7759475003 Tukey values for duration are 3.71106 (avg) 3.71106 (min) 3.71106 (max). 5.018342024 Tukey values for wtgain*duration are 8.54265 (avg) 8.54265 (min) 8.54265 (max). 735 RUN; 736 QUIT; Factorial ANOVA (CRD with factorial treatment arrangement) Analysis of duration of patients stay in hospital Analysis of Variance done with PROC MIXED The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structure Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.KIDNEY days Diagonal REML Profile Model-Based Residual James P. Geaghan Copyright 2010 Statistical Methods I (EXST 7005) Appendix 6 Page 210 Class Level Information Class Levels Values wtgain 3 Mild Moderate Severe duration 2 Long Short Dimensions Covariance Parameters Columns in X Columns in Z Subjects Max Obs Per Subject Number Number Number Number of of of of 1 12 0 1 60 Observations Observations Read Observations Used Observations Not Used 60 60 0 Covariance Parameter Estimates Cov Parm Estimate Residual 28.9778 Fit Statistics -2 Res Log Likelihood AIC (smaller is better) AICC (smaller is better) BIC (smaller is better) 348.9 350.9 350.9 352.8 Type 3 Tests of Fixed Effects Num Den Effect DF DF wtgain 2 54 duration 1 54 wtgain*duration 2 54 F Value 13.12 7.21 1.88 Pr > F <.0001 0.0096 0.1622 Least Squares Means Effect wtgain wtgain wtgain duration duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain Mild Moderate Severe Mild Mild Moderate Moderate Severe Severe duration Long Short Long Short Long Short Long Short Estimate 2.4500 5.5000 11.0500 4.4667 8.2000 2.2000 2.7000 3.7000 7.3000 7.5000 14.6000 Standard Error 1.2037 1.2037 1.2037 0.9828 0.9828 1.7023 1.7023 1.7023 1.7023 1.7023 1.7023 DF 54 54 54 54 54 54 54 54 54 54 54 t Value 2.04 4.57 9.18 4.54 8.34 1.29 1.59 2.17 4.29 4.41 8.58 Pr > |t| 0.0467 <.0001 <.0001 <.0001 <.0001 0.2017 0.1186 0.0341 <.0001 <.0001 <.0001 Differences ofLeast Squares Means Effect wtgain wtgain wtgain duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain Mild Mild Moderate Mild Mild Mild Mild Mild Mild Mild Mild Mild Moderate Moderate duration Long Long Long Long Long Long Short Short Short Short Long Long _wtgain Moderate Severe Severe Mild Moderate Moderate Severe Severe Moderate Moderate Severe Severe Moderate Severe _duration Short Short Long Short Long Short Long Short Long Short Short Long Estimate -3.0500 -8.6000 -5.5500 -3.7333 -0.5000 -1.5000 -5.1000 -5.3000 -12.4000 -1.0000 -4.6000 -4.8000 -11.9000 -3.6000 -3.8000 Standard Error 1.7023 1.7023 1.7023 1.3899 2.4074 2.4074 2.4074 2.4074 2.4074 2.4074 2.4074 2.4074 2.4074 2.4074 2.4074 DF 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 t Value -1.79 -5.05 -3.26 -2.69 -0.21 -0.62 -2.12 -2.20 -5.15 -0.42 -1.91 -1.99 -4.94 -1.50 -1.58 James P. Geaghan Copyright 2010 Statistical Methods I (EXST 7005) wtgain*duration wtgain*duration wtgain*duration wtgain*duration Moderate Moderate Moderate Severe Long Short Short Long Appendix 6 Severe Severe Severe Severe Differences ofLeast Squares Means Effect wtgain duration wtgain wtgain wtgain duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration wtgain*duration Mild Mild Moderate Mild Mild Mild Mild Mild Mild Mild Mild Mild Moderate Moderate Moderate Moderate Moderate Severe Short Long Short Short _wtgain Page 211 -10.9000 -0.2000 -7.3000 -7.1000 _duration 2.4074 2.4074 2.4074 2.4074 Pr > |t| Moderate Severe Severe Long Long Long Long Long Long Short Short Short Short Long Long Long Short Short Long Mild Moderate Moderate Severe Severe Moderate Moderate Severe Severe Moderate Severe Severe Severe Severe Severe Short Short Long Short Long Short Long Short Long Short Short Long Short Long Short Short 0.0788 <.0001 0.0019 0.0096 0.8362 0.5359 0.0388 0.0320 <.0001 0.6795 0.0613 0.0512 <.0001 0.1406 0.1203 <.0001 0.9341 0.0037 0.0047 54 54 54 54 -4.53 -0.08 -3.03 -2.95 Adjustment Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Tukey Adj P 0.1820 <.0001 0.0054 0.0096 0.9999 0.9888 0.2935 0.2540 <.0001 0.9983 0.4069 0.3592 0.0001 0.6686 0.6159 0.0005 1.0000 0.0411 0.0507 Factorial ANOVA (CRD with factorial treatment arrangement) Analysis of duration of patients stay in hospital Analysis of Variance done with PROC MIXED Post hoc adjustment with macro by Arnold Saxton Effect=wtgain ADJUSTMENT=Tukey(P<.01) BYGROUP=1 Obs wtgain duration Estimate StdErr 1 Severe 11.0500 1.2037 2 Moderate 5.5000 1.2037 3 Mild 2.4500 1.2037 Effect=duration ADJUSTMENT=Tukey(P<.01) BYGROUP=2 Obs wtgain duration Estimate StdErr 4 Short 8.2000 0.9828 5 Long 4.4667 0.9828 MSGROUP A B B MSGROUP A B Effect=wtgain*duration ADJUSTMENT=Tukey(P<.01) BYGROUP=3 Obs wtgain duration Estimate StdErr MSGROUP 6 Severe Short 14.6000 1.7023 A 7 Severe Long 7.5000 1.7023 AB 8 Moderate Short 7.3000 1.7023 AB 9 Moderate Long 3.7000 1.7023 B 10 Mild Short 2.7000 1.7023 B 11 Mild Long 2.2000 1.7023 B 738 proc univariate data=resids normal plot; var resid; 739 TITLE4 'Univariate analysis of RESIDUALS'; 740 run; NOTE: The PROCEDURE UNIVARIATE printed page 4. NOTE: PROCEDURE UNIVARIATE used (Total process time): real time 0.18 seconds cpu time 0.09 seconds James P. Geaghan Copyright 2010 Statistical Methods I (EXST 7005) Appendix 6 Page 212 Factorial ANOVA (CRD with factorial treatment arrangement) Analysis of duration of patients stay in hospital Analysis of Variance done with PROC MIXED Univariate analysis of RESIDUALS The UNIVARIATE Procedure Variable: Resid Moments N Mean Std Deviation Skewness Uncorrected SS Coeff Variation 60 0 5.14995475 0.75823095 1564.8 . Sum Weights Sum Observations Variance Kurtosis Corrected SS Std Error Mean Basic Statistical Measures Location Variability Mean 0.00000 Std Deviation Median -0.70000 Variance Mode -2.70000 Range Interquartile Range 60 0 26.5220339 1.26399843 1564.8 0.6648563 5.14995 26.52203 27.00000 5.00000 NOTE: The mode displayed is the smallest of 2 modes with a count of 3. Tests for Location: Mu0=0 Test -StatisticStudent's t t 0 Sign M -5 Signed Rank S -89 Tests for Normality Test Shapiro-Wilk Kolmogorov-Smirnov Cramer-von Mises Anderson-Darling -----p Value-----Pr > |t| 1.0000 Pr >= |M| 0.2451 Pr >= |S| 0.5169 --Statistic--W 0.954062 D 0.098822 W-Sq 0.162545 A-Sq 0.96946 -----p Value-----Pr < W 0.0243 Pr > D 0.1496 Pr > W-Sq 0.0171 Pr > A-Sq 0.0149 Quantiles (Definition 5) Quantile Estimate 100% Max 15.4 99% 15.4 95% 11.4 90% 6.4 75% Q3 2.3 50% Median -0.7 25% Q1 -2.7 10% -5.8 5% -7.1 1% -11.6 0% Min -11.6 Extreme Observations ----Lowest---Value Obs -11.6 29 -9.6 24 -7.6 27 -6.6 23 -6.5 60 ----Highest--Value Obs 7.7 15 10.4 25 12.4 30 12.7 20 15.4 28 James P. Geaghan Copyright 2010 Statistical Methods I (EXST 7005) Stem 14 12 10 8 6 4 2 0 -0 -2 -4 -6 -8 -10 Leaf 4 47 4 Appendix 6 Page 213 Boxplot 57 57833 33533 345834588 775227777532 7533777773222 3653 6653 6 6 ----+----+----+----+ 1 2 1 0 0 0 2 5 5 9 12 13 4 4 1 1 | | +-----+ | + | *-----* +-----+ | | | 0 Normal Probability Plot 15+ * | * * ++ | * ++++ | ++++ | +**+ | +**** | ++**** | ++**** | ****** | ****** | ***++ | **+**+ | *+++ -11+ *+++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 751 PROC GLM DATA=kidney; CLASS WTGAIN DURATION; 752 TITLE3 'Example of a 2 way ANOVA done with PROC GLM'; 753 MODEL DAYS = WTGAIN DURATION WTGAIN*DURATION / SS3; 754 LSMEANS WTGAIN DURATION WTGAIN*DURATION / PDIFF STDERR ADJUST=TUKEY; 755 output out=next residual=e; 756 RUN; 756 ! QUIT; NOTE: The data set WORK.NEXT has 60 observations and 7 variables. NOTE: The PROCEDURE GLM printed pages 5-9. NOTE: PROCEDURE GLM used (Total process time): real time 0.32 seconds cpu time 0.15 seconds 757 758 ods html close; 759 ods rtf close; 760 ods PDF close; NOTE: ODS PDF printed 18 pages to C:\EXST 7005\SAS\Example06.PDF. 761 762 run; 763 quit; James P. Geaghan Copyright 2010 Statistical Methods I (EXST 7005) Appendix 6 Page 214 Factorial ANOVA (CRD with factorial treatment arrangement) Analysis of duration of patients stay in hospital Example of a 2 way ANOVA done with PROC GLM The GLM Procedure Class Level Information Class Levels Values wtgain 3 Mild Moderate Severe duration 2 Long Short Number of Observations Read Number of Observations Used 60 60 Factorial ANOVA (CRD with factorial treatment arrangement) Analysis of duration of patients stay in hospital Example of a 2 way ANOVA done with PROC GLM The GLM Procedure Dependent Variable: days Sum of Squares 1078.533333 1564.800000 2643.333333 Source Model Error Corrected Total DF 5 54 59 R-Square 0.408020 Root MSE 5.383101 Coeff Var 84.99633 Source wtgain duration wtgain*duration DF 2 1 2 Mean Square 215.706667 28.977778 F Value 7.44 Pr > F <.0001 Mean Square 380.2166667 209.0666667 54.5166667 F Value 13.12 7.21 1.88 Pr > F <.0001 0.0096 0.1622 days Mean 6.333333 Type III SS 760.4333333 209.0666667 109.0333333 The GLM Procedure Least Squares Means Adjustment for Multiple Comparisons: Tukey wtgain Mild Moderate Severe days LSMEAN Standard Error Pr > |t| LSMEAN Number 2.4500000 5.5000000 11.0500000 1.2036980 1.2036980 1.2036980 0.0467 <.0001 <.0001 1 2 3 Least Squares Means for effect wtgain Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: days i/j 1 2 3 1 0.1820 <.0001 2 0.1820 3 <.0001 0.0054 0.0054 James P. Geaghan Copyright 2010 Statistical Methods I (EXST 7005) Appendix 6 Page 215 Factorial ANOVA (CRD with factorial treatment arrangement) Analysis of duration of patients stay in hospital Example of a 2 way ANOVA done with PROC GLM The GLM Procedure Least Squares Means Adjustment for Multiple Comparisons: Tukey duration Long Short Standard Error 0.98281531 0.98281531 days LSMEAN 4.46666667 8.20000000 H0:LSMean1= LSMean2 Pr > |t| 0.0096 H0:LSMEAN=0 Pr > |t| <.0001 <.0001 The GLM Procedure Least Squares Means Adjustment for Multiple Comparisons: Tukey wtgain duration Mild Mild Moderate Moderate Severe Severe Long Short Long Short Long Short days LSMEAN Standard Error Pr > |t| LSMEAN Number 2.2000000 2.7000000 3.7000000 7.3000000 7.5000000 14.6000000 1.7022860 1.7022860 1.7022860 1.7022860 1.7022860 1.7022860 0.2017 0.1186 0.0341 <.0001 <.0001 <.0001 1 2 3 4 5 6 Least Squares Means for effect wtgain*duration Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: days i/j 1 2 3 4 5 6 1 0.9999 0.9888 0.2935 0.2540 <.0001 2 0.9999 0.9983 0.4069 0.3592 0.0001 3 0.9888 0.9983 0.6686 0.6159 0.0005 4 0.2935 0.4069 0.6686 1.0000 0.0411 5 0.2540 0.3592 0.6159 1.0000 6 <.0001 0.0001 0.0005 0.0411 0.0507 0.0507 James P. Geaghan Copyright 2010 ...
View Full Document

This note was uploaded on 12/29/2011 for the course EXST 7005 taught by Professor Geaghan,j during the Fall '08 term at LSU.

Ask a homework question - tutors are online