Transcription of Design of Experiments - STAT
1 Design of Experiments 1. Analysis of Variance 2. More about Single Factor Experiments 3. Randomized Blocks, Latin Squares 4. Factorial Designs Designs 6. Blocking and ConfoundingMontgomery, (1997): Design and Analysis of Experiments (4th ed.), Single Factor Analysis of VarianceExample:Investigatetensile strengthyof new synthetic :ydepends on the weight percent of cotton(which should range within 10% 40%).Decision:(a) test specimens at 5 levels of cotton weight: 15%, 20%, 25%, 30%, 35%.(b) test 5 specimens at each level of cotton Factor Experimentwitha= 5levelsandn= should be inRandom Order(prohibit warm up effects of machine.)
2 2 CottonObservationWeight % 1 2 3 4 5 Total Average157 7 15 11 9 17 12 18 18 18 18 19 19 25 22 19 23 10 11 15 11 > y <- c( 7, 7, .. , 15, 11); w <- gl(5, 5, labels=c(15, 20, 25, 30, 35))> tapply(y, w, sum) # total15 20 25 30 3549 77 88 108 54> tapply(y, w, mean) # average15 20 25 30 > mean(tapply(y, w, mean)) # mean average[1] > boxplot(y~w); plot( (w), y); points(tapply(y, w, mean), pch=20)1520253035051015202530 Cotton Weight PercentTensile Strength12345051015202530 Cotton Weight PercentTensile StrengthWe wish to test for differences between the mean strengths at alla= 5levels ofcotton weight percent Analysis of of Variance (ANOVA)Use theLinear Regression Modelyij= + i+ ijfor treatmenti= 1.
3 , a, and replicationj= 1, .. , (ith treatment,jth replication)Parameter is common to all treatments (Overall Mean)Parameter iis unique to theith treatment (ith Treatment Effect)Random variable ijis theRandom assumption: ijiid N(0, 2).Our interest is in the treatment Effects i:Fixed: theatreatments are chosen by the experimenter.(tests and conclusions will only apply to the factor levels considered)Fixed Effects ModelRandom: theatreatments are a random sample from a population of treatments.(we are able to extend conclusions to all treatments in the population)Random Effects Model / Components of Variance Model6 Fixed Effects ModelTreatment effects iare usually defined as the deviations from the overall mean :=1aa i=1 i=1aa i=1( + i) = +1aa i=1 i,Thus, we have a restriction on these effects, namelya i=1 i= , i=E(yij)is the mean of all observationsyijin theith treatment (row).
4 7 ANOVA DecompositionWe are interested in testing the equality of theatreatment meansH0: 1= 2= = a H0: 1= 2= = awhich is equivalent to testing the equality of all treatment Sum of Squares decomposition in Regression is validSST=SSR+SSEwhereSSR, theSum ofSquares due to theRegression model, is only related tothe treatment effects i. Hence, we havea i=1n j=1(yij )2=a i=1n j=1( i )2+a i=1n j=1(yij i)28 estimates the overall mean , where we assume that all theyijare from thesame population.
5 Thus, this estimate is given as =1Na i=1n j=1yij=:y whereN=anis the total number of observations. iestimates the mean of theyijcoming only from theith row (treatment). Thisgives the estimate i=1nn j=1yij=:yi Together this givesa i=1n j=1(yij y )2=na i=1(yi y )2+a i=1n j=1(yij yi )29 Therefore, the total variability in the data can be partitioned into a sum of squaresof the differencesbetweenthe treatment averages and the grand average, plusa sum of squares of the differences of observationswithintreatments from thetreatment TableSource ofSum of Degrees of MeanVariationSquares Freedom SquareFBetween TreatmentsSSRa 1 MSR MSR/MSEE rror (within Treatments)
6 SSEN aMSET otalSSTN 110 Tensile Strength Data: TestH0: 1= 2= 3= 4= 5againstH1: some means are differentSource ofSum of Degrees of MeanVariationSquares Freedom SquareF4,20p-valueCotton Weight Percent < (within Treatments) , we rejectH0and conclude that the treatment means differ!> summary(aov(y~w))Df Sum Sq Mean Sq F value Pr(>F)w 4 **Residuals 20 codes: 0 ** ** * . 111 Estimation of the Model ParametersRemember the model:yij= + i+ ijwith overall mean , treatment means i= + i, and treatment effects estimates are =y i=yi = i=yi y Because ofyijiid N( i, 2)yi =1nn j=1yij N( i,1n 2)12 Moreover,MSEestimates 2and the(1 )confidence interval for theithtreatment mean iis[yi t1 /2,N a MSE/n]> W <- C(w, treatment).
7 Coefficients(aov(y~W)) # default contrast for w(Intercept) W20 W25 W30 > W <- C(w, sum); coefficients(aov(y~W))(Intercept) W1 W2 W3 > options(contrasts=c(" ", " ")) # for all factors13 Bartlett s Test for Equality of Variances:H0: 21= 22= = 2aK2is based on the (pooled) sample variances and approximately 2a 1.> (y~W)Bartlett test for homogeneity of variancesdata: y by WBartlett s K-squared = , df = 4, p-value = Conclude that all 5 variances are the same!
8 This test is very sensitive to the normality assumption!14 Variance-Stabilizing Transformation:Let E(y) = be the mean ofyand suppose that the standard deviation isproportional to a power of the mean y Task: find a transformation ofythat yields a constant variance. Suppose this isy =y where = 0implies the log transformation. Then y (1 )Setting = 1 , then the variance of the transformed data is yand = 1 Transformation y const01no transformation y 1/21/21/2 Square Root y 10 Log y 3/23/2 1/2 Reciprocal Square Root y 22 1 ReciprocalSelection of the Power:If yi i= ithenlog yi= log + log iA plot oflog yiversuslog iis a straight line with slope.
9 Substitute yiand iby their estimatesSiandyi and guess the value of from the :4 different estimation methods of the peak discharge applied to thesame (cubic feet / second)yi > y <- c( , , .., ); m <- gl(4, 6, labels=c(1, 2, 3, 4))> tapply(y, m, mean); tapply(y, m, sd)1 2 3 2 3 > summary(aov(y~m))Df Sum Sq Mean Sq F value Pr(>F)m 3 **Residuals 20 > r <- residuals(aov(y~m)); f <- fitted(aov(y~m)); plot(f, r)> ls <- log(tapply(y, m, sd)); lm <- log(tapply(y, m, mean))> plot(lm, ls).
10 Abline(lm(ls~lm)) # gives slope = 4 2024fitted valuesresiduals 10123 mean_ilog S_i18> (y~m)Bartlett test for homogeneity of variancesdata: y by mBartlett s K-squared = , df = 3, p-value = Bartlett Test rejects Equality of Variances. Thus we analyzey = y.> ry <- sqrt(y); tapply(ry, m, sd)1 2 3 > summary(aov(ry~m))Df Sum Sq Mean Sq F value Pr(>F)m 3 **Residuals 20 account for the use of the data to estimate we reduce the error degrees offreedom by one.