EXST7015 Fall2011 Appendix 15

EXST7015 Fall2011 Appendix 15 - 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 Appendix 15a SAS Example Treatment Arrangements Page 284 1 dm"log;clear;output;clear"; 2 3 options ps=61 ls=78 nocenter nonumber nodate; 4 **EXAMPLE 7********************************************; 5 *** Example of a Factorial Design ***; 6 *** From Snedecor & Cochran, 1980 (pg 305) ***; 7 *******************************************************; 8 OPTIONS PS=256 LS=78 NOCENTER NODATE PAGENO=1; 9 DATA RATS (KEEP=LEVEL SOURCE REP TREATMNT GAIN); INFILE CARDS MISSOVER; 10 ARRAY G GAIN1-GAIN10; 11 INPUT LEVEL $ SOURCE $ TREATMNT $ 1-11 GAIN1-GAIN10; 12 DO REP = 1 TO 10; 13 GAIN = G{REP}; OUTPUT; END; 14 TITLE1 'EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS'; 15 TITLE2 'FACTORIAL DESIGN (2 POR 3) WITH REPLICATES'; 16 CARDS; NOTE: The data set WORK.RATS has 60 observations and 5 variables. NOTE: DATA statement used: real time 3.46 seconds cpu time 0.07 seconds 16 ! RUN; 23 ; 24 PROC PRINT; TITLE3 'RAW DATA LISTING'; RUN; NOTE: There were 60 observations read from the data set WORK.RATS. NOTE: The PROCEDURE PRINT printed page 1. NOTE: PROCEDURE PRINT used: real time 1.19 seconds cpu time 0.03 seconds EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS FACTORIAL DESIGN (2 POR 3) WITH REPLICATES RAW DATA LISTING Obs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 LEVEL HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH HIGH SOURCE BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL PORK PORK PORK PORK PORK PORK PORK PORK PORK TREATMNT HIGH BEEF HIGH BEEF HIGH BEEF HIGH BEEF HIGH BEEF HIGH BEEF HIGH BEEF HIGH BEEF HIGH BEEF HIGH BEEF HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH CEREAL HIGH PORK HIGH PORK HIGH PORK HIGH PORK HIGH PORK HIGH PORK HIGH PORK HIGH PORK HIGH PORK REP 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 GAIN 73 102 118 104 81 107 100 87 117 111 98 74 56 111 95 88 82 77 86 92 94 79 96 98 102 102 108 91 120 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 HIGH LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW PORK BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL PORK PORK PORK PORK PORK PORK PORK PORK PORK PORK HIGH LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW LOW PORK BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF BEEF CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL CEREAL PORK PORK PORK PORK PORK PORK PORK PORK PORK PORK 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 105 90 76 90 64 86 51 72 90 95 78 107 95 97 80 98 74 74 67 89 58 49 82 73 86 81 97 106 70 61 82 25 PROC SORT DATA=RATS; BY LEVEL SOURCE; RUN; NOTE: There were 60 observations read from the data set WORK.RATS. NOTE: The data set WORK.RATS has 60 observations and 5 variables. NOTE: PROCEDURE SORT used: real time 0.55 seconds cpu time 0.05 seconds James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15a SAS Example Treatment Arrangements Page 285 26 PROC mixed DATA=RATS CL METHOD=TYPE3; CLASSES LEVEL SOURCE; 27 TITLE3 'FACTORIAL DONE AS 2 WAY ANOVA IN PROC MIXED'; 28 MODEL GAIN = LEVEL SOURCE LEVEL*SOURCE / htype=3 OUTP=ResidData; 29 RUN; NOTE: The data set WORK.RESIDDATA has 60 observations and 12 variables. NOTE: The PROCEDURE MIXED printed page 2. NOTE: PROCEDURE MIXED used: real time 1.70 seconds cpu time 0.17 seconds EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS FACTORIAL DESIGN (2 POR 3) WITH REPLICATES FACTORIAL DONE AS 2 WAY ANOVA IN PROC MIXED The Mixed Procedure Model Information Data Set WORK.RATS Dependent Variable GAIN Covariance Structure Diagonal Estimation Method Type 3 Residual Variance Method Factor Fixed Effects SE Method Model-Based Degrees of Freedom Method Residual Class LEVEL SOURCE Class Level Information Levels Values 2 HIGH LOW 3 BEEF CEREAL PORK Dimensions Covariance Parameters Columns in X Columns in Z Subjects Max Obs Per Subject Observations Used Observations Not Used Total Observations 1 12 0 1 60 60 0 60 Type 3 Analysis of Variance Sum of Source DF Squares LEVEL 1 3168.266667 SOURCE 2 266.533333 LEVEL*SOURCE 2 1178.133333 Residual 54 11586 Source LEVEL SOURCE LEVEL*SOURCE Residual Mean Square 3168.266667 133.266667 589.066667 214.555556 Type 3 Analysis of Variance Expected Mean Square Var(Residual)+Q(LEVEL,LEVEL*SOURCE) Var(Residual)+ Q(SOURCE,LEVEL*SOURCE) Var(Residual)+Q(LEVEL*SOURCE) Var(Residual) Error Term MS(Residual) MS(Residual) MS(Residual) . Error DF 54 54 54 . Type 3 Analysis of Variance Source F Value Pr > F LEVEL 14.77 0.0003 SOURCE 0.62 0.5411 LEVEL*SOURCE 2.75 0.0732 Residual . . James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15a SAS Example Treatment Arrangements Cov Parm Residual Page 286 Covariance Parameter Estimates Estimate Alpha Lower 214.56 0.05 152.06 Fit Statistics -2 Res Log Likelihood AIC (smaller is better) AICC (smaller is better) BIC (smaller is better) Upper 325.57 457.0 459.0 459.0 461.0 Type 3 Tests of Fixed Effects Num Den Effect DF DF F Value LEVEL 1 54 14.77 SOURCE 2 54 0.62 LEVEL*SOURCE 2 54 2.75 Pr > F 0.0003 0.5411 0.0732 30 PROC UNIVARIATE DATA=ResidData NORMAL PLOT; VAR RESID; 31 TITLE3 'PROC UNIVARIATE analysis of residuals'; RUN; NOTE: The PROCEDURE UNIVARIATE printed page 3. NOTE: PROCEDURE UNIVARIATE used: real time 0.09 seconds cpu time 0.02 seconds EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS FACTORIAL DESIGN (2 POR 3) WITH REPLICATES PROC UNIVARIATE analysis of residuals The UNIVARIATE Procedure Variable: Resid N Mean Std Deviation Skewness Uncorrected SS Coeff Variation Moments 60 Sum Weights 0 Sum Observations 14.0133109 Variance -0.3576888 Kurtosis 11586 Corrected SS . Std Error Mean Basic Statistical Measures Location Variability Mean 0.00000 Std Deviation Median 2.20000 Variance Mode 10.80000 Range Interquartile Range 60 0 196.372881 -0.3451246 11586 1.80911065 14.01331 196.37288 57.20000 19.60000 Tests for Location: Mu0=0 Test -Statistic-----p Value-----Student's t t 0 Pr > |t| 1.0000 Sign M 3.5 Pr >= |M| 0.4350 Signed Rank S 40.5 Pr >= |S| 0.7627 Test Shapiro-Wilk Kolmogorov-Smirnov Cramer-von Mises Anderson-Darling Tests for Normality --Statistic--W 0.976634 D 0.090078 W-Sq 0.052988 A-Sq 0.361662 -----p Value-----Pr < W 0.3032 Pr > D >0.1500 Pr > W-Sq >0.2500 Pr > A-Sq >0.2500 James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15a Treatment Arrangements SAS Example Page 287 Quantiles (Definition 5) Quantile Estimate 100% Max 27.30 99% 27.30 95% 21.80 90% 17.50 75% Q3 10.80 50% Median 2.20 25% Q1 -8.80 10% -19.75 5% -27.60 1% -29.90 0% Min -29.90 Extreme Observations ----Lowest-------Highest--Value Obs Value Obs -29.9 13 18.3 56 -29.7 51 20.5 29 -28.2 36 23.1 41 -27.0 1 25.1 14 -25.9 50 27.3 57 Stem 2 2 1 1 0 0 -0 -0 -1 -1 -2 -2 -3 Leaf # 57 2 03 2 6788 4 11111234 8 56677789 8 0022222334 10 444321 6 998766 6 3200 4 9875 4 0 1 876 3 00 2 ----+----+----+----+ Multiply Stem.Leaf by 10**+1 Boxplot | | | +-----+ | | *--+--* | | +-----+ | | | | | Normal Probability Plot 27.5+ +*++ * | +** | **** | ****** | ****+ | ****+ -2.5+ ***+ | ****+ | +*+ | ++*** | +++ * | * ++*+** * -32.5+ +++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15a SAS Example Treatment Arrangements Page 288 33 PROC MEANS DATA=RATS NOPRINT; BY LEVEL SOURCE; VAR GAIN; 34 OUTPUT OUT=RATMEANS N=N MEAN=MEAN VAR=VAR; RUN; NOTE: There were 60 observations read from the data set WORK.RATS. NOTE: The data set WORK.RATMEANS has 6 observations and 7 variables. NOTE: PROCEDURE MEANS used: real time 0.92 seconds cpu time 0.06 seconds 35 PROC PRINT DATA=RATMEANS; TITLE3 'LISTING OF MEANS'; RUN; NOTE: There were 6 observations read from the data set WORK.RATMEANS. NOTE: The PROCEDURE PRINT printed page 4. NOTE: PROCEDURE PRINT used: real time 0.01 seconds cpu time 0.01 seconds EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS FACTORIAL DESIGN (2 POR 3) WITH REPLICATES LISTING OF MEANS Obs 1 2 3 4 5 6 LEVEL HIGH HIGH HIGH LOW LOW LOW SOURCE BEEF CEREAL PORK BEEF CEREAL PORK _TYPE_ 0 0 0 0 0 0 _FREQ_ 10 10 10 10 10 10 N 10 10 10 10 10 10 MEAN 100.0 85.9 99.5 79.2 83.9 78.7 VAR 229.111 225.656 119.167 192.844 246.767 273.789 35 OPTIONS PS=35; 36 PROC PLOT DATA=RATMEANS; TITLE3 'PLOT OF MEANS'; PLOT 36 ! MEAN*SOURCE=LEVEL; RUN; NOTE: There were 6 observations read from the data set WORK.RATMEANS. NOTE: The PROCEDURE PLOT printed page 5. NOTE: PROCEDURE PLOT used: real time 0.01 seconds cpu time 0.01 seconds EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS FACTORIAL DESIGN (2 POR 3) WITH REPLICATES PLOT OF MEANS Plot of MEAN*SOURCE. Symbol is value of LEVEL. MEAN | 100 + H H | | | | | | 90 + | | | H | L | | 80 + | L L | | | | | 70 + ---+----------------------+----------------------+-BEEF CEREAL PORK SOURCE James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15a SAS Example Treatment Arrangements Page 289 37 PROC PLOT DATA=RATMEANS; TITLE3 'VARIANCE ON MEANS PLOT'; PLOT VAR*MEAN; RUN; 38 OPTIONS PS=256; NOTE: There were 6 observations read from the data set WORK.RATMEANS. NOTE: The PROCEDURE PLOT printed page 6. NOTE: PROCEDURE PLOT used: real time 0.01 seconds cpu time 0.01 seconds EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS FACTORIAL DESIGN (2 POR 3) WITH REPLICATES VARIANCE ON MEANS PLOT Plot of VAR*MEAN. Legend: A = 1 obs, B = 2 obs, etc. VAR | 300 + | | | A | 250 + A | | A A | | 200 + | A | | | 150 + | | | A | 100 + | --+-------------+-------------+-------------+-------------+------------75 80 85 90 95 100 MEAN 40 41 42 PROC GLM DATA=RATS; CLASSES LEVEL SOURCE; TITLE3 'FACTORIAL DONE AS 2 WAY ANOVA IN GLM'; TITLE4 'ALL TREATMENTS PROBABLY SHOULD BE FIXED, RUN AS MIXED MODEL TO SHOW EMS'; 43 MODEL GAIN = LEVEL SOURCE LEVEL*SOURCE; 44 RANDOM LEVEL SOURCE LEVEL*SOURCE / TEST; 45 RUN; NOTE: TYPE I EMS not available without the E1 option. 46 47 NOTE: The PROCEDURE GLM printed pages 7-10. NOTE: PROCEDURE GLM used: real time 0.73 seconds cpu time 0.04 seconds James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15a SAS Example Treatment Arrangements Page 290 EXST7015: WEIGHT GAIN IN RATS ON VARIOUS DIETS FACTORIAL DESIGN (2 POR 3) WITH REPLICATES FACTORIAL DONE AS 2 WAY ANOVA IN GLM ALL TREATMENTS PROBABLY SHOULD BE FIXED, RUN AS MIXED MODEL TO SHOW EMS The GLM Procedure Class Level Information Class Levels Values LEVEL 2 HIGH LOW SOURCE 3 BEEF CEREAL PORK Number of observations 60 Dependent Variable: GAIN Source Model Error Corrected Total R-Square 0.284768 Coeff Var 16.67039 DF 5 54 59 Sum of Squares 4612.93333 11586.00000 16198.93333 Root MSE 14.64772 Mean Square 922.58667 214.55556 F Value 4.30 Pr > F 0.0023 GAIN Mean 87.86667 Source LEVEL SOURCE LEVEL*SOURCE DF 1 2 2 Type I SS 3168.266667 266.533333 1178.133333 Mean Square 3168.266667 133.266667 589.066667 F Value 14.77 0.62 2.75 Pr > F 0.0003 0.5411 0.0732 Source LEVEL SOURCE LEVEL*SOURCE DF 1 2 2 Type III SS 3168.266667 266.533333 1178.133333 Mean Square 3168.266667 133.266667 589.066667 F Value 14.77 0.62 2.75 Pr > F 0.0003 0.5411 0.0732 Source LEVEL SOURCE LEVEL*SOURCE Type III Expected Mean Square Var(Error) + 10 Var(LEVEL*SOURCE) + 30 Var(LEVEL) Var(Error) + 10 Var(LEVEL*SOURCE) + 20 Var(SOURCE) Var(Error) + 10 Var(LEVEL*SOURCE) Tests of Hypotheses for Random Model Analysis of Variance Dependent Variable: GAIN Source DF Type III SS Mean Square LEVEL 1 3168.266667 3168.266667 SOURCE 2 266.533333 133.266667 Error 2 1178.133333 589.066667 Error: MS(LEVEL*SOURCE) Source LEVEL*SOURCE Error: MS(Error) DF 2 54 Type III SS 1178.133333 11586 Mean Square 589.066667 214.555556 F Value 5.38 0.23 Pr > F 0.1462 0.8155 F Value 2.75 Pr > F 0.0732 48 data rats; set rats; 49 if level eq 'HIGH' then gainh = gain; 50 if level eq 'LOW' then gainl = gain; 51 run; NOTE: There were 60 observations read from the data set WORK.RATS. NOTE: The data set WORK.RATS has 60 observations and 7 variables. NOTE: DATA statement used: real time 0.74 seconds cpu time 0.02 seconds James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15a SAS Example Treatment Arrangements Page 291 53 GOPTIONS DEVICE=cgm GSFMODE=REPLACE GSFNAME=OUT1 NOPROMPT noROTATE; 54 FILENAME OUT1 'C:\SAS\rats01.CGM'; 55 PROC GPLOT DATA=rats; 56 TITLE3 F=SWISS H=1 'Plot with standard 2x errors to examine interaction'; 57 PLOT gainh*source=1 gainl*source=2 / OVERLAY HAXIS=AXIS1 VAXIS=AXIS2; 58 AXIS1 LABEL=(F=SWISS H=1 'Protein source') WIDTH=5 MINOR=(N=4) 59 VALUE=(F=SWISS H=1); 60 AXIS2 LABEL=(F=SWISS H=1 'Weight gain') WIDTH=6 61 VALUE=(F=SWISS H=1) MINOR=(N=4) ORDER= 70 TO 110 BY 10; 62 SYMBOL1 C=RED L=1 V=NONE I=STD1mjtp W=1 H=1mode=include; 63 SYMBOL2 C=BLUE L=1 V=NONE I=STD1mjtp W=1 H=1mode=include; 64 **** V = dot would place a dot for each point; 65 **** I = requests STD (std dev) 1 (1 width, 2 or 3) M (of mean=std err) 66 J (join means of bars) t (add top & bottom hash) p (use pooled variance); 67 **** Other options: omit M=std dev, use B to get bar for min/max; 68 * SYMBOL1 C=green L=1 V=dot I=none W=1 H=1 mode=include; 69 * SYMBOL2 C=magenta L=1 V=dot I=none W=1 H=1 mode=include; 70 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: 30 observation(s) contained a MISSING value for the gainh * SOURCE request. NOTE: 6 observation(s) outside the axis range for the gainh * SOURCE request. NOTE: 30 observation(s) contained a MISSING value for the gainl * SOURCE request. NOTE: 6 observation(s) outside the axis range for the gainl * SOURCE request. NOTE: 24 RECORDS WRITTEN TO C:\SAS\rats01.CGM 70 ! QUIT; NOTE: There were 60 observations read from the data set WORK.RATS. NOTE: PROCEDURE GPLOT used: real time 4.13 seconds cpu time 0.22 seconds 71 72 GOPTIONS GSFNAME=OUT2; FILENAME OUT2 'C:\SAS\RATS02.CGM'; 73 PROC GCHART DATA=RATS; TITLE3 'BLOCK CHART TO EXAMINE INTERACTIONS'; 74 BLOCK SOURCE / GROUP=LEVEL SUMVAR=GAIN TYPE=MEAN DISCRETE; 75 PATTERN C=RED V=S;RUN; NOTE: 25 RECORDS WRITTEN TO C:\SAS\RATS02.CGM WEIGHT GAIN IN RATS ON VARIOUS DIETS Weight gain FACTORIAL DESIGN (2 POR 3) WITH REPLICATES Plot with 2x standard errors to examine interaction 110 100 90 80 70 BEEF CEREAL PORK Protein source James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Page 292 80 *EXAMPLE 8 ********************************************; 81 *** Example of a 2*2*2 Factorial De295sign ***; 82 *** From Snedecor & Cochran, 1980 (pg 359) ***; 83 *******************************************************; 84 OPTIONS PS=256 LS=78 NOCENTER NODATE PAGENO=1; NOTE: There were 60 observations read from the data set WORK.RATS. NOTE: PROCEDURE GCHART used: real time 0.28 seconds cpu time 0.04 seconds 85 DATA PIGS (KEEP=LYSINE PROTEIN REP SEX GAIN); INFILE CARDS MISSOVER 85 ! ; 86 ARRAY G GAIN1-GAIN8; 87 INPUT LYSINE PROTEIN SEX $ GAIN1-GAIN8; 88 FORMAT GAIN 5.1; 89 DO REP = 1 TO 8; 90 GAIN = G{REP}; OUTPUT; END; 91 TITLE1 'EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS'; 92 TITLE2 'FACTORIAL DESIGN (2x2x2) WITH REPLICATES'; 93 CARDS; NOTE: The data set WORK.PIGS has 64 observations and 5 variables. NOTE: DATA statement used: real time 0.29 seconds cpu time 0.02 seconds 93 ! RUN; 102 ; 103 PROC PRINT; TITLE3 'RAW DATA LISTING'; RUN; NOTE: There were 64 observations read from the data set WORK.PIGS. NOTE: The PROCEDURE PRINT printed page 1. NOTE: PROCEDURE PRINT used: real time 0.02 seconds cpu time 0.01 seconds EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS FACTORIAL DESIGN (2x2x2) WITH REPLICATES RAW DATA LISTING Obs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 LYSINE 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 PROTEIN 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 SEX M M M M M M M M F F F F F F F F M M M M M M M M F F F F F F F GAIN 1.1 1.0 1.1 1.0 0.9 1.2 1.3 1.0 1.0 1.0 1.0 1.0 1.0 1.2 1.2 1.2 1.5 1.5 1.3 1.2 1.7 1.2 1.3 1.3 1.5 1.2 1.5 1.2 1.2 1.6 1.1 REP 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 0.0 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 14 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 F M M M M M M M M F F F F F F F F M M M M M M M M F F F F F F F F 1.4 1.2 1.1 1.3 1.4 1.3 1.2 1.3 1.3 0.9 1.0 1.2 1.3 1.0 1.1 1.4 1.3 1.4 1.1 1.4 1.2 1.5 1.4 1.2 1.2 1.1 1.1 1.5 1.4 1.2 1.2 1.0 1.1 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Page 293 104 PROC SORT DATA=PIGS; BY LYSINE PROTEIN SEX; RUN; NOTE: There were 64 observations read from the data set WORK.PIGS. NOTE: The data set WORK.PIGS has 64 observations and 5 variables. NOTE: PROCEDURE SORT used: real time 0.05 seconds cpu time 0.04 seconds 105 PROC MIXED DATA=PIGS CL METHOD=TYPE3; CLASSES LYSINE PROTEIN SEX; 106 TITLE3 'ANALYSIS OF VARIANCE WITH MIXED'; 107 MODEL GAIN = LYSINE|PROTEIN|SEX / htype=3 OUTP=ResidData; 108 RUN; NOTE: The data set WORK.RESIDDATA has 64 observations and 12 variables. NOTE: The PROCEDURE MIXED printed page 2. NOTE: PROCEDURE MIXED used: real time 0.53 seconds cpu time 0.13 seconds 108 ! QUIT; EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS FACTORIAL DESIGN (2x2x2) WITH REPLICATES ANALYSIS OF VARIANCE WITH MIXED The Mixed Procedure Model Information Data Set WORK.PIGS Dependent Variable GAIN Covariance Structure Diagonal Estimation Method Type 3 Residual Variance Method Factor Fixed Effects SE Method Model-Based Degrees of Freedom Method Residual Class LYSINE PROTEIN SEX Class Level Information Levels Values 2 0 0.6 2 12 14 2 F M Dimensions Covariance Parameters Columns in X Columns in Z Subjects Max Obs Per Subject Observations Used Observations Not Used Total Observations 1 27 0 1 64 64 0 64 Type 3 Analysis of Variance Sum of Source DF Squares LYSINE 1 0.003164 PROTEIN 1 0.430664 LYSINE*PROTEIN 1 0.258827 SEX 1 0.057002 LYSINE*SEX 1 0.037539 PROTEIN*SEX 1 0.000076562 LYSINE*PROTEIN*SEX 1 0.011289 Residual 56 1.240538 Mean Square 0.003164 0.430664 0.258827 0.057002 0.037539 0.000076562 0.011289 0.022152 James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Page 294 Type 3 Analysis of Variance Error DF Source Expected Mean Square Error Term LYSINE Var(Residual) + Q(LYSINE,LYSINE*PROTEIN,LYSINE* SEX,LYSINE*PROTEIN*SEX) Var(Residual) + Q(PROTEIN,LYSINE*PROTEIN,PROTEIN* SEX,LYSINE*PROTEIN*SEX) Var(Residual) + Q(LYSINE*PROTEIN,LYSINE* PROTEIN*SEX) Var(Residual) + Q(SEX,LYSINE*SEX,PROTEIN* SEX,LYSINE*PROTEIN*SEX) Var(Residual) + Q(LYSINE*SEX,LYSINE*PROTEIN*SEX) Var(Residual) + Q(PROTEIN*SEX,LYSINE*PROTEIN*SEX) Var(Residual) + Q(LYSINE*PROTEIN*SEX) Var(Residual) MS(Residual) 56 MS(Residual) 56 MS(Residual) 56 MS(Residual) 56 MS(Residual) 56 MS(Residual) 56 MS(Residual) 56 PROTEIN LYSINE*PROTEIN SEX LYSINE*SEX PROTEIN*SEX LYSINE*PROTEIN*SEX Residual . . Type 3 Analysis of Variance Source F Value Pr > F LYSINE 0.14 0.7069 PROTEIN 19.44 <.0001 LYSINE*PROTEIN 11.68 0.0012 SEX 2.57 0.1143 LYSINE*SEX 1.69 0.1983 PROTEIN*SEX 0.00 0.9533 LYSINE*PROTEIN*SEX 0.51 0.4783 Residual . . Cov Parm Residual Covariance Parameter Estimates Estimate Alpha Lower 0.02215 0.05 0.01579 Fit Statistics -2 Res Log Likelihood AIC (smaller is better) AICC (smaller is better) BIC (smaller is better) Upper 0.03334 -37.8 -35.8 -35.7 -33.8 Type 3 Tests of Fixed Effects Num Den Effect DF DF F Value LYSINE 1 56 0.14 PROTEIN 1 56 19.44 LYSINE*PROTEIN 1 56 11.68 SEX 1 56 2.57 LYSINE*SEX 1 56 1.69 PROTEIN*SEX 1 56 0.00 LYSINE*PROTEIN*SEX 1 56 0.51 Pr > F 0.7069 <.0001 0.0012 0.1143 0.1983 0.9533 0.4783 110 PROC UNIVARIATE DATA=ResidData NORMAL PLOT; VAR RESID; 111 TITLE3 'PROC UNIVARIATE analysis of residuals'; RUN; NOTE: The PROCEDURE UNIVARIATE printed page 3. NOTE: PROCEDURE UNIVARIATE used: James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Page 295 EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS FACTORIAL DESIGN (2x2x2) WITH REPLICATES PROC UNIVARIATE analysis of residuals The UNIVARIATE Procedure Variable: Resid N Mean Std Deviation Skewness Uncorrected SS Coeff Variation Moments 64 Sum Weights 0 Sum Observations 0.14032488 Variance 0.24838382 Kurtosis 1.2405375 Corrected SS . Std Error Mean Basic Statistical Measures Location Variability Mean 0.00000 Std Deviation Median -0.03625 Variance Mode -0.08625 Range Interquartile Range 64 0 0.01969107 -0.9998829 1.2405375 0.01754061 0.14032 0.01969 0.56375 0.23500 Tests for Location: Mu0=0 Test -Statistic-----p Value-----Student's t t 0 Pr > |t| 1.0000 Sign M -3 Pr >= |M| 0.5323 Signed Rank S -9 Pr >= |S| 0.9526 Test Shapiro-Wilk Kolmogorov-Smirnov Cramer-von Mises Anderson-Darling Tests for Normality --Statistic--W 0.959246 D 0.12541 W-Sq 0.193266 A-Sq 1.027144 -----p Value-----Pr < W 0.0334 Pr > D 0.0137 Pr > W-Sq 0.0064 Pr > A-Sq 0.0098 Quantiles (Definition 5) Quantile Estimate 100% Max 0.29125 99% 0.29125 95% 0.23125 90% 0.19125 75% Q3 0.12375 50% Median -0.03625 25% Q1 -0.11125 10% -0.15875 5% -0.20750 1% -0.27250 0% Min -0.27250 Extreme Observations ------Lowest---------Highest----Value Obs Value Obs -0.27250 33 0.22625 52 -0.20875 13 0.23125 15 -0.20875 23 0.23125 22 -0.20750 58 0.26625 51 -0.19375 55 0.29125 29 James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Stem 2 2 1 1 0 0 -0 -0 -1 -1 -2 -2 Leaf # 79 2 2333 4 556789 6 0113444 7 566799 6 2344 4 4320 4 999988877665 12 44442211110 11 9865 4 111 3 7 1 ----+----+----+----+ Multiply Stem.Leaf by 10**-1 Page 296 Boxplot | | | +-----+ | | | + | *-----* | | +-----+ | | | Normal Probability Plot 0.275+ ++*+ * | **** | ****+ | ****+ | ***++ | +*** | ++*** | +****** | ******* | ***++ | * **+ -0.275+ * ++++ +----+----+----+----+----+----+----+----+----+----+ -2 -1 0 +1 +2 113 PROC MEANS DATA=PIGS NOPRINT; BY LYSINE PROTEIN; VAR GAIN; 114 OUTPUT OUT=PIGMEANS N=N MEAN=MEAN VAR=VAR; RUN; NOTE: There were 64 observations read from the data set WORK.PIGS. NOTE: The data set WORK.PIGMEANS has 4 observations and 7 variables. NOTE: PROCEDURE MEANS used: real time 0.25 seconds cpu time 0.04 seconds 115 DATA PIGMEANS; SET PIGMEANS; PROT='H'; IF PROTEIN LE 12 THEN 115 ! PROT='L'; RUN; NOTE: There were 4 observations read from the data set WORK.PIGMEANS. NOTE: The data set WORK.PIGMEANS has 4 observations and 8 variables. NOTE: DATA statement used: real time 0.08 seconds cpu time 0.04 seconds 116 PROC PRINT DATA=PIGMEANS; TITLE3 'LISTING OF MEANS'; RUN; NOTE: There were 4 observations read from the data set WORK.PIGMEANS. NOTE: The PROCEDURE PRINT printed page 4. NOTE: PROCEDURE PRINT used: real time 0.02 seconds cpu time 0.01 seconds 117 OPTIONS PS=35; 118 PROC PLOT DATA=PIGMEANS; TITLE3 'PLOT OF MEANS'; 119 PLOT MEAN*LYSINE=PROT; RUN; James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Page 297 EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS FACTORIAL DESIGN (2x2x2) WITH REPLICATES LISTING OF MEANS Obs 1 2 3 4 LYSINE 0.0 0.0 0.6 0.6 PROTEIN 12 14 12 14 _TYPE_ 0 0 0 0 _FREQ_ 16 16 16 16 N 16 16 16 16 MEAN 1.1 1.4 1.2 1.2 VAR 0.016033 0.027172 0.023105 0.023453 PROT L H L H EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS FACTORIAL DESIGN (2x2x2) WITH REPLICATES PLOT OF MEANS Plot of MEAN*LYSINE. Symbol is value of PROT. MEAN | 1.4 + | | H | | 1.3 + | | | H | 1.2 + L | | | | 1.1 + | | L | | 1.0 + | ---+-----------------------------------------------+-0.0 0.6 LYSINE 120 GOPTIONS GSFNAME=OUT2; FILENAME OUT2 120 ! 'C:\SAS\PIGS.CGM'; NOTE: There were 4 observations read from the data set WORK.PIGMEANS. NOTE: The PROCEDURE PLOT printed page 5. NOTE: PROCEDURE PLOT used: real time 0.03 seconds cpu time 0.01 seconds 121 PROC GCHART DATA=PIGS; TITLE3 'BLOCK CHART TO EXAMINE INTERACTIONS' 121 ! ; 122 BLOCK lysine / GROUP=PROTEIN SUMVAR=GAIN TYPE=MEAN DISCRETE; 123 PATTERN C=RED V=S; RUN; NOTE: 22 RECORDS WRITTEN TO C:\SAS\PIGS.CGM 124 OPTIONS PS=256 LS=78; NOTE: There were 64 observations read from the data set WORK.PIGS. NOTE: PROCEDURE GCHART used: real time 0.26 seconds cpu time 0.06 seconds James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Page 298 126 PROC GLM DATA=PIGS; CLASSES LYSINE PROTEIN SEX; 127 TITLE3 'ANALYSIS OF VARIANCE WITH GLM'; 128 TITLE4 'ALL TREATMENTS PROBABLY SHOULD BE FIXED, RUN AS MIXED 128 ! MODEL TO SHOW EMS'; 129 MODEL GAIN = LYSINE|PROTEIN|SEX; 130 RANDOM LYSINE|PROTEIN LYSINE*SEX PROTEIN*SEX LYSINE*PROTEIN*SEX / 130 ! TEST; 131 RUN; NOTE: TYPE I EMS not available without the E1 option. 131 ! QUIT; NOTE: The PROCEDURE GLM printed pages 6-9. NOTE: PROCEDURE GLM used: real time 0.09 seconds cpu time 0.09 seconds EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS FACTORIAL DESIGN (2x2x2) WITH REPLICATES ANALYSIS OF VARIANCE WITH GLM ALL TREATMENTS PROBABLY SHOULD BE FIXED, RUN AS MIXED MODEL TO SHOW EMS The GLM Procedure Class Level Information Class Levels Values LYSINE 2 0 0.6 PROTEIN 2 12 14 SEX 2 F M Number of observations 64 Dependent Variable: GAIN Source Model Error Corrected Total R-Square 0.391625 Coeff Var 12.19819 DF 7 56 63 Sum of Squares 0.79856094 1.24053750 2.03909844 Root MSE 0.148837 Mean Square 0.11408013 0.02215246 F Value 5.15 Pr > F 0.0001 GAIN Mean 1.220156 Source LYSINE PROTEIN LYSINE*PROTEIN SEX LYSINE*SEX PROTEIN*SEX LYSINE*PROTEIN*SEX DF 1 1 1 1 1 1 1 Type I SS 0.00316406 0.43066406 0.25882656 0.05700156 0.03753906 0.00007656 0.01128906 Mean Square 0.00316406 0.43066406 0.25882656 0.05700156 0.03753906 0.00007656 0.01128906 F Value 0.14 19.44 11.68 2.57 1.69 0.00 0.51 Pr > F 0.7069 <.0001 0.0012 0.1143 0.1983 0.9533 0.4783 Source LYSINE PROTEIN LYSINE*PROTEIN SEX LYSINE*SEX PROTEIN*SEX LYSINE*PROTEIN*SEX DF 1 1 1 1 1 1 1 Type III SS 0.00316406 0.43066406 0.25882656 0.05700156 0.03753906 0.00007656 0.01128906 Mean Square 0.00316406 0.43066406 0.25882656 0.05700156 0.03753906 0.00007656 0.01128906 F Value 0.14 19.44 11.68 2.57 1.69 0.00 0.51 Pr > F 0.7069 <.0001 0.0012 0.1143 0.1983 0.9533 0.4783 James P. Geaghan - Copyright 2011 Statistical Techniques II Appendix 15b SAS Example Treatment Arrangements Page 299 EXST7015: PIG WEIGHT GAIN WITH DIET SUPPLEMENTS FACTORIAL DESIGN (2x2x2) WITH REPLICATES ANALYSIS OF VARIANCE WITH GLM ALL TREATMENTS PROBABLY SHOULD BE FIXED, RUN AS MIXED MODEL TO SHOW EMS The GLM Procedure Source LYSINE PROTEIN LYSINE*PROTEIN SEX LYSINE*SEX PROTEIN*SEX Type III Expected Mean Square Var(Error) + 8 Var(LYSINE*PROTEIN*SEX) + 16 Var(LYSINE*SEX) + 16 Var(LYSINE*PROTEIN) + 32 Var(LYSINE) Var(Error) + 8 Var(LYSINE*PROTEIN*SEX) + 16 Var(PROTEIN*SEX) + 16 Var(LYSINE*PROTEIN) + 32 Var(PROTEIN) Var(Error) + 8 Var(LYSINE*PROTEIN*SEX) + 16 Var(LYSINE*PROTEIN) Var(Error) + 8 Var(LYSINE*PROTEIN*SEX) + 16 Var(PROTEIN*SEX) + 16 Var(LYSINE*SEX) + Q(SEX) Var(Error) + 8 Var(LYSINE*PROTEIN*SEX) + 16 Var(LYSINE*SEX) Var(Error) + 8 Var(LYSINE*PROTEIN*SEX) + 16 Var(PROTEIN*SEX) Tests of Hypotheses for Mixed Model Analysis of Variance Dependent Variable: GAIN Source DF Type III SS Mean Square F Value LYSINE 1 0.003164 0.003164 0.01 Error 1.1859 0.338079 0.285077 Error: MS(LYSINE*PROTEIN) + MS(LYSINE*SEX) - MS(LYSINE*PROTEIN*SEX) Pr > F 0.9310 Source DF Type III SS Mean Square F Value PROTEIN 1 0.430664 0.430664 1.74 Error 0.9135 0.226195 0.247614 Error: MS(LYSINE*PROTEIN) + MS(PROTEIN*SEX) - MS(LYSINE*PROTEIN*SEX) Pr > F 0.4279 Source DF LYSINE*PROTEIN 1 LYSINE*SEX 1 PROTEIN*SEX 1 Error 1 Error: MS(LYSINE*PROTEIN*SEX) F Value 22.93 3.33 0.01 Pr > F 0.1311 0.3193 0.9477 Source DF Type III SS Mean Square F Value SEX 1 0.057002 0.057002 2.17 Error 0.451 0.011874 0.026327 Error: MS(LYSINE*SEX) + MS(PROTEIN*SEX) - MS(LYSINE*PROTEIN*SEX) Pr > F 0.5332 Source LYSINE*PROTEIN*SEX Error: MS(Error) Pr > F 0.4783 DF 1 56 Type III SS 0.258827 0.037539 0.000076563 0.011289 Type III SS 0.011289 1.240537 Mean Square 0.258827 0.037539 0.000076563 0.011289 Mean Square 0.011289 0.022152 F Value 0.51 James P. Geaghan - Copyright 2011 ...
View Full Document

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

Ask a homework question - tutors are online