Week 3 & 4 Randomized Blocks, Latin Squares, and Related Designs

Similar documents
Lecture 7: Latin Square and Related Design

Lecture 7: Latin Squares and Related Designs

Chapter 4: Randomized Blocks and Latin Squares

Chapter 4 Experiments with Blocking Factors

DESAIN EKSPERIMEN BLOCKING FACTORS. Semester Genap 2017/2018 Jurusan Teknik Industri Universitas Brawijaya

STAT22200 Spring 2014 Chapter 13B

STAT 430 (Fall 2017): Tutorial 8

Chapter 12. Analysis of variance

Ch 2: Simple Linear Regression

3. Design Experiments and Variance Analysis

Lec 1: An Introduction to ANOVA

STAT 525 Fall Final exam. Tuesday December 14, 2010

RCB - Example. STA305 week 10 1

22s:152 Applied Linear Regression. Take random samples from each of m populations.

Ch 3: Multiple Linear Regression

2-way analysis of variance

22s:152 Applied Linear Regression. There are a couple commonly used models for a one-way ANOVA with m groups. Chapter 8: ANOVA

Stat 217 Final Exam. Name: May 1, 2002

Lecture 11: Nested and Split-Plot Designs

Unit 6: Orthogonal Designs Theory, Randomized Complete Block Designs, and Latin Squares

Simple Linear Regression

Unit 8: 2 k Factorial Designs, Single or Unequal Replications in Factorial Designs, and Incomplete Block Designs

Stat 502 Design and Analysis of Experiments General Linear Model

Section 4.6 Simple Linear Regression

Assignment 6 Answer Keys

Lecture 4. Random Effects in Completely Randomized Design

STAT 510 Final Exam Spring 2015

Lecture 6 Multiple Linear Regression, cont.

Contents. TAMS38 - Lecture 6 Factorial design, Latin Square Design. Lecturer: Zhenxia Liu. Factorial design 3. Complete three factor design 4

The Distribution of F

Lecture 10. Factorial experiments (2-way ANOVA etc)

Vladimir Spokoiny Design of Experiments in Science and Industry

Lec 5: Factorial Experiment

More about Single Factor Experiments

UNIVERSITY OF TORONTO Faculty of Arts and Science

Analysis of Covariance

MATH 644: Regression Analysis Methods

Lecture 1: Linear Models and Applications

Inference for Regression

STK4900/ Lecture 3. Program

Factorial and Unbalanced Analysis of Variance

QUEEN MARY, UNIVERSITY OF LONDON

Stat 6640 Solution to Midterm #2

Lecture 2. The Simple Linear Regression Model: Matrix Approach

Two-Way Analysis of Variance - no interaction

Lecture 5: Comparing Treatment Means Montgomery: Section 3-5

Models for Clustered Data

Sleep data, two drugs Ch13.xls

Unit 12: Analysis of Single Factor Experiments

21.0 Two-Factor Designs

Models for Clustered Data

STATISTICS 368 AN EXPERIMENT IN AIRCRAFT PRODUCTION Christopher Wiens & Douglas Wiens

Lecture 9: Factorial Design Montgomery: chapter 5

Simple Linear Regression

SCHOOL OF MATHEMATICS AND STATISTICS

Analysis of Covariance. The following example illustrates a case where the covariate is affected by the treatments.

Unit 7: Random Effects, Subsampling, Nested and Crossed Factor Designs

Extensions of One-Way ANOVA.

19. Blocking & confounding

Chapter 4 Randomized Blocks, Latin Squares, and Related Designs Solutions

Extensions of One-Way ANOVA.

Stat 5102 Final Exam May 14, 2015

Linear Regression. In this lecture we will study a particular type of regression model: the linear regression model

1. The (dependent variable) is the variable of interest to be measured in the experiment.

Stat 579: Generalized Linear Models and Extensions

Multiple comparisons - subsequent inferences for two-way ANOVA

STAT Final Practice Problems

Written Exam (2 hours)


Matrices and vectors A matrix is a rectangular array of numbers. Here s an example: A =

Homework 3 - Solution

THE UNIVERSITY OF CHICAGO Booth School of Business Business 41912, Spring Quarter 2012, Mr. Ruey S. Tsay

ST505/S697R: Fall Homework 2 Solution.

STAT 135 Lab 10 Two-Way ANOVA, Randomized Block Design and Friedman s Test

Multi-Factor Experiments

ANOVA (Analysis of Variance) output RLS 11/20/2016

What is Experimental Design?

Example: Poisondata. 22s:152 Applied Linear Regression. Chapter 8: ANOVA

Two-Way Factorial Designs

Lecture 4 Multiple linear regression

Introduction to Design and Analysis of Experiments with the SAS System (Stat 7010 Lecture Notes)

Incomplete Block Designs

CAS MA575 Linear Models

VIII. ANCOVA. A. Introduction

Analysis of Variance. Read Chapter 14 and Sections to review one-way ANOVA.

Lecture 6: Linear models and Gauss-Markov theorem

1. (Rao example 11.15) A study measures oxygen demand (y) (on a log scale) and five explanatory variables (see below). Data are available as

Page: 3, Line: 24 ; Replace 13 Building... with 13 More on Multiple Regression. Page: 83, Line: 9 ; Replace The ith ordered... with The jth ordered...

Multiple Linear Regression

The Pennsylvania State University The Graduate School Eberly College of Science INTRABLOCK, INTERBLOCK AND COMBINED ESTIMATES

Swarthmore Honors Exam 2012: Statistics

PROBLEM TWO (ALKALOID CONCENTRATIONS IN TEA) 1. Statistical Design

What If There Are More Than. Two Factor Levels?

DETAILED CONTENTS PART I INTRODUCTION AND DESCRIPTIVE STATISTICS. 1. Introduction to Statistics

[y i α βx i ] 2 (2) Q = i=1

Single Factor Experiments

Introduction and Background to Multilevel Analysis

with the usual assumptions about the error term. The two values of X 1 X 2 0 1

Multiple Regression: Example

Analysis of Variance (ANOVA) Cancer Research UK 10 th of May 2018 D.-L. Couturier / R. Nicholls / M. Fernandes

Transcription:

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 1/81 Week 3 & 4 Randomized Blocks, Latin Squares, and Related Designs Joslin Goh Simon Fraser University

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 2/81 Outline 31 Randomized Complete Block Design 32 Balanced Incomplete Block Design 33 Latin Square Design 34 Graeco-Latin Square Design 35 Analysis of Covariance

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 3/81 31 Randomized Complete Block Design Blocking is to systematically eliminate its effect on treatment effects Within each block, subjects are assumed to be homogeneous The variations within blocks should be less than the variations between blocks Nuisance factor: a design factor that may have an effect on the response but is not of primary interest Unknown and uncontrollable: randomization Known and uncontrollable: analysis of covariance Known and controllable: blocking

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 4/81 Examples a Four training processes for IQ Score, 16 Students, each of 4 students are from the same department b Test 3 crop varieties on 5 fields c An industrial engineer is conducting an experiment on eye focus time He is interested in the effect of the distance of the object from the eye on the focus time Four different distances are of interest He has five subjects available for the experiment

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 5/81 Model y ij = µ+τ i +β j +ǫ ij,i = 1,,a,j = 1,,b µ: grand/overall mean τ i : ith treatment effect, a i=1 τ i = 0 β j : jth block effect, b j=1 β j = 0 ǫ ij : experimental error iid N(0,σ 2 )

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 6/81 Estimates y ij = ˆµ+ ˆτ i + ˆβ j +r ij

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 7/81 ANOVA decomposition a i=1 b a b (y ij ȳ ) 2 = b (ȳ i ȳ ) 2 +a (ȳ j ȳ ) 2 j=1 i=1 i=1 j=1 j=1 a b + (y ij ȳ i ȳ j +ȳ ) 2 SS Total = SS Treatments +SS Blocks +SS Error

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 8/81 ANOVA Table Source Sum of Square DOF Mean Square F Treatments b a i=1 (ȳ i ȳ ) 2 a-1 MS MS Treatments Treatments MS Error Blocks a b j=1 (ȳ j ȳ ) 2 b-1 MS Blocks Error SS Total SS Treatments SS Blocks (a-1)(b-1) MS Error Total b j=1 (y ij ȳ ) 2 N-1 a i=1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 9/81 E(MS Error ) = σ 2 E(MS Treatments ) = σ 2 + b a i=1 τ2 i a 1 E(MS Blocks ) = σ 2 + a b j=1 β2 j b 1 Effective blocking

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 10/81 Hypothesis testing H 0 : τ 1 = τ 2 = = τ a H 1 : i j such that τ i τ j If F > F α,a 1,(a 1)(b 1), reject H 0 at level α

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 11/81 Assumption checking Normality: normal probability plot Independence: Constant variance: Additivity between blocks and treatments (Tukey s non-additivity test)

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 12/81 Multiple comparisons a If H 0 is rejected, multiple comparisons of τ i s should be performed b Tukey multiple comparison method declares treatments i and j are statistical different if t ij = c Simultaneous CI for τ i τ j are ȳ i ȳ j ˆσ 1/b+1/b > 1 2 q α,a,(a 1)(b 1) ȳ i ȳ j ±q α,a,(a 1)(b 1) ˆσ b

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 13/81 Example of Penicillin Comparison of four variants of a penicillin product process It was known that an important raw material, corn steep liquor, was quite variable Each blend of corn steep liquor is sufficient for four runs The experiment was protected from extraneous unknown sources of bias by running the treatments in random order within each block Block Treatment Block (blend of corn steep liquor) A B C D average blend 1 89 (1) 88 (3) 97 (2) 94 (4) 92 blend 2 84 (4) 77 (2) 92 (3) 79 (1) 83 blend 3 81 (2) 87 (1) 87 (4) 85 (3) 85 blend 4 87 (1) 92 (3) 89 (2) 84 (4) 88 blend 5 79 (3) 81 (4) 80 (1) 88 (2) 82 Treatment Average 84 85 89 86 86=Grand Average

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 14/81 Graphical check yield 80 85 90 95 yield 80 85 90 95 A B C D treat Blend1 Blend2 Blend3 Blend4 Blend5 blend plot(yield blend+treat,data=penicillin)

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 15/81 Interaction plots penicillin$blend penicillin$treat mean of penicillin$yield 80 85 90 95 Blend1 Blend5 Blend3 Blend4 Blend2 mean of penicillin$yield 80 85 90 95 D B C A A B C D penicillin$treat Blend1 Blend2 Blend3 Blend4 Blend5 penicillin$blend interactionplot(penicillin$treat,penicillin$blend,penicillin$yield) interactionplot(penicillin$blend,penicillin$treat,penicillin$yield)

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 16/81 Fit the model > g <- lm(yield treat+blend,penicillin) > summary(g) Call: lm(formula = yield treat + blend, data = penicillin) Coefficients: Estimate Std Error t value Pr(> t ) (Intercept) 90000 2745 32791 41e-13 *** treatb 1000 2745 0364 072194 treatc 5000 2745 1822 009351 treatd 2000 2745 0729 048018 blendblend2-9000 3069-2933 001254 * blendblend3-7000 3069-2281 004159 * blendblend4-4000 3069-1304 021686 blendblend5-10000 3069-3259 000684 ** --- Signif codes: 0 *** 0001 ** 001 * 005 01 1 Residual standard error: 434 on 12 degrees of freedom Multiple R-squared: 05964, Adjusted R-squared: 0361 F-statistic: 2534 on 7 and 12 DF, p-value: 007535

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 17/81 Normality assumption Normal Q Q Plot Sample Quantiles 4 2 0 2 4 6 2 1 0 1 2 Theoretical Quantiles

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 18/81 Independence assumption Residuals 4 2 0 2 4 6 5 10 15 20 Run order

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 19/81 Constant variance assumption Residuals 4 2 0 2 4 6 80 85 90 95 Fitted

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 20/81 Constant variance assumption > bartletttest(yield treat,penicillin) Bartlett test of homogeneity of variances data: yield by treat Bartlett s K-squared = 06901, df = 3, p-value = 08755 > bartletttest(yield blend,penicillin) Bartlett test of homogeneity of variances data: yield by blend Bartlett s K-squared = 23859, df = 4, p-value = 06652

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 21/81 Tukey s Non-additivity Test Use package alr3 > tukeynonaddtest(g) t value Pr(> t ) 03134771 07539182

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 22/81 > anova(g) Analysis of Variance Table Response: yield Df Sum Sq Mean Sq F value Pr(>F) treat 3 70000 23333 12389 033866 blend 4 264000 66000 35044 004075 * Residuals 12 226000 18833 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 23/81 Fitting the model with the interaction term > alpha <- c(0,g$coef[2:4]) > alpha treatb treatc treatd 0 1 5 2 > beta <- c(0,g$coef[5:8]) > beta blendblend2 blendblend3 blendblend4 blendblend5 0-9 -7-4 -10 > ab <- rep(alpha,5)*rep(beta,rep(4,5)) > h <- update(g, +ab) > anova(h) Analysis of Variance Table Response: yield Df Sum Sq Mean Sq F value Pr(>F) treat 3 70000 23333 11458 037360 blend 4 264000 66000 32411 005488 ab 1 2001 2001 00983 075978 Residuals 11 223999 20364 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 24/81 Multiple comparisons Fisher s LSD ( Least Significant Difference ) Bonferroni method Tukey method

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 25/81 Example 2: This experiment is to assess the effects of four different cholesterol-reducing diets on persons who have hypercholesterolemia To run a CRBD, the blocks are chosen to represent combinations of the various gender-age-body size categories of interest For each block of subjects, the four diets are randomly assigned to the sample of four persons in the block Each subject is then followed for one year, after which the change in cholesterol level is recorded Gender: Male/Female Age: Above/Below 50 Body Size: Quatelet index above/below 35

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 26/81 Factor: Diet Treatments: Diet 1, 2, 3, 4

> g <- lm(change diet+block,cholesterol) > summary(g) Call: lm(formula = change diet + block, data = cholesterol) Coefficients:Estimate Std Error t value Pr(> t ) (Intercept) 117156 05680 20625 203e-15 *** dietb -22125 04844-4567 0000167 *** dietc -21125 04844-4361 0000274 *** dietd -26375 04844-5445 211e-05 *** blockb2-49000 06851-7153 472e-07 *** blockb3 46250 06851 6751 112e-06 *** blockb4-30750 06851-4489 0000202 *** blockb5 28250 06851 4124 0000483 *** blockb6-11750 06851-1715 0101038 blockb7 75000 06851 10948 388e-10 *** blockb8 10750 06851 1569 0131552 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1 Residual standard error: 09688 on 21 degrees of freedom Multiple R-squared: 09618, Adjusted R-squared: 09436 F-statistic: 5289 on 10 and 21 DF, p-value: 1312e-12 Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 27/81

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 28/81 > anova(g) Analysis of Variance Table Response: change Df Sum Sq Mean Sq F value Pr(>F) diet 3 3356 1119 11918 9011e-05 *** block 7 46286 6612 70445 3742e-13 *** Residuals 21 1971 094

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 29/81 32 Balanced Incomplete Block Design Gathering faculty teaching evaluations by in-class and online surveys: their effects on response rates and evaluations by Curt J Dommeyer, Paul Baum, Robert W Hanna and Kenneth S Chapman Experimental Design: The study was conducted using undergraduate business majors at California State University, Northridge A total of 16 instructors participated in the study Although the sample of instructors represents a convenience sample, the courses represent a cross-section of lower and upper division core courses that are required for business majors Courses by area online treatment Accounting Business Law Economics Finance Management Marketing Management Sci Total Grade incentive 1 2 1 4 Grade feedback 1 1 2 Incentive Demo 1 1 2 Control group 2 1 1 1 1 2 8 Total 4 1 3 1 4 1 2 16

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 30/81 Each of the instructors in this study was assigned to have one of his/her sections evaluated in-class and the other evaluated online In the online evaluation, each instructor was assigned either to a control group or to one of the following online treatments: 1 a very modest grade incentive (one-quarter of a percent) for completing the online evaluations; 2 an in-class demonstration of how to log on to the web site and complete the form; 3 an early grade feedback incentive in which students were told they would receive early feedback of their course grades (by postcard and/or posting the grades online) if at least two-thirds of the class completed online evaluations

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 31/81 Seven different hardwood concentrations are being studied to determine their effect on the strength of the paper produced However, the pilot plant can only produce three runs each day As days may differ, the analyst uses the following design Hardwood Days Concentration(%) 1 2 3 4 5 6 7 2 114 120 117 4 126 120 119 6 137 117 134 8 141 129 149 10 145 150 143 12 120 118 123 14 136 130 127

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 32/81 Definition and notation A Balanced Incomplete Block Design BIBD(N,a,k,b,r,λ) is an incomplete block design in which

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 33/81 a: the number of treatments k: the block size b: the number of blocks r: the number of times each treatment occurs λ: the number of times each pair of treatments appears in the same block N: the number of observations

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 34/81 Some contraints Note that for some values of a,r,b,k, there do not exist a BIBD For example, a = 8,r = 8,k = 4,b = 16

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 35/81 Examples block 1 A C D block 2 A B C block 3 B C D block 4 A B D block 1 A B block 2 A C block 3 B C

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 36/81 Model y ij = µ+τ i +β j +ǫ ij,i = 1,,a,j = 1,b µ: overall mean τ i : ith treatment effect, i τ i = 0 β j : jth block effect, j β j = 0 ǫ ij : random error ǫ ij iid N(0,σ 2 ) Note: 1 Not all y ij exists 2 Treatments and blocks are not orthogonal (independent)

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 37/81 Estimation where ˆµ = ȳ ; ˆτ i = kq i λa ; ˆβj = rq j λb Q i = y i 1 k b j=1 n ijy j ; Q j = y j 1 r a i=1 n ijy i ; n ij is 1 if treatment i appears in block j and 0 otherwise; i ˆτ i = 0; j ˆβ j = 0; i Q i = 0; Var(Q i ) = (k 1)r k σ 2 and Var(ˆτ i ) = k(a 1) λa 2 σ 2 ; Q i is the adjusted total for ith treatment and they are not independent (Var(ˆτ i ˆτ j ) = 2kσ 2 /(λa))

Note the blocks are incomplete and thus ȳ i ȳ is not an unbiased estimate of τ i For example E(ȳ 1 ) = µ+τ 1 +(β 1 +β 2 +β 3 )/3 E(ȳ ) = µ E(ȳ 1 ȳ ) = τ 1 +(β 1 +β 2 +β 3 )/3 Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 38/81

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 39/81 ANOVA Table Define: SS Total = i,j (y ij ȳ ) 2 = i,j y 2 ij y2 N SS Blocks = k j (ȳ j ȳ ) 2 = 1 k j y 2 j y2 N SS Treatments(adjusted) = k a i=1 Q2 i λa SS Error = SS Total SS Blocks SS Treatments(adjusted)

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 40/81 Source Sum of Squares DOF Mean Squares F Blocks SS Blocks b 1 SS Blocks /(b 1) Trts(adjusted) SS Treatments(adjusted) a 1 SS Treatments(adjusted) /(a 1) Error SS Error N a b+1 SS Error /(N a b+1) Total SS Total N 1 MS Treamtments(adjusted) SS Error Test statistic for testing the equality of the treatment effect is F = MS Treamtments(adjusted) SS Error

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 41/81 Assessing Block Effects To assess the block effects, we use and SS Blocks(adjusted) = r b j=1 (Q j )2 λb SS Total = SS Treatments + SS Blocks(adjusted) + SS Error But SS Total SS Treatments(adjusted) + SS Blocks(adjusted) + SS Error

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 42/81 Confidence interval For τ i τ j Fisher LSD CI Tukey s CI ˆτ i ˆτ j ±t α/2,n a b+1 2k λa MS Error ˆτ i ˆτ j ± q α,a,n a b+1 2 2k λa MS Error

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 43/81 Working Example Suppose that a chemical engineer thinks that the time of reaction for a chemical process is a function of the type of catalyst employed Four catalysts are currently being investigated The experimental procedure consists of selecting a batch of raw material, loading the pilot plant, applying each catalyst in a separate run of the pilot plant, and observing the reaction time Because variations in the batches of raw material may affect the performance of the catalysts, the engineer decides to use batches of raw material as blocks However, each batch is only large enough to permit three catalysts to be run Therefore a randomized incomplete block design must be used Treatment Blocks(Batch of Raw Material) (Catalyst) 1 2 3 4 y i 1 73 74-71 218 2-75 67 72 214 3 73 75 68-216 4 75-72 75 222 y j 221 224 207 218 870=y

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 44/81 In the example, we have Q 1 = 218 1 3 (221+224+218) = 9/3 Q 2 = 214 1 3 (207+224+218) = 7/3 Q 3 = 216 1 3 (221+207+224) = 4/3 Q 4 = 222 1 3 (221+207+218) = 20/3

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 45/81 For example: SS Total = i,j y2 ij y2 N SS Blocks = 1 k = 63156 8702 12 = 81 j y2 j y2 N = 1 3 (2212 +207 2 +224 2 +218 2 ) 8702 12 = 55 SS Treatments(adjusted) = [( 9/3)2 +( 7/3) 2 +( 4/3) 2 +(20/3) 2 ]) 2 4 = 2275 SS Error = 81 2275 55 = 325

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 46/81 Example Incorrect analysis for testing equality of treatment effects > g<-lm(y Treatment + Block, catalyst) > anova(g) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) Treatment 3 11667 3889 59829 00414634 * Block 3 66083 22028 338889 00009528 *** Residuals 5 3250 0650 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 47/81 Correct analysis for testing equality of treatment effects > g<-lm(y Block + Treatment, catalyst) > anova(g) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) Block 3 55000 18333 28205 0001468 ** Treatment 3 22750 7583 11667 0010739 * Residuals 5 3250 0650 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 48/81 #set the parameters a<-4 b<-4 k<-3 r<-3 n<-12 lambda<-r*(k-1)/(a-1) # create n_ij Nij<-matrix(0,a,a) for(i in 1:n) Nij[asinteger(Treatment[i]),asinteger(Block[i])]<-1 # compute y_i ysumi<-vector( numeric,a) for(i in 1:a) ysumi[i]<-sum(y[((i-1)*r+1):(i*r)]) #compute y_j ysumj<-vector( numeric,b) for(i in 1:n) {ysumj[asinteger(block[i])]<- ysumj[asinteger(block[i])] + y[i]} #compute Q_i Qi<-vector("numeric",a) for(i in 1:a) Qi[i]<-ysumi[i]-sum(Nij[i,]*ysumj)/k #compute hat of tau_i tauihat<-k*qi/(lambda*a)

> #(1-alpha)100% Fisher LSD CI for tau_i- tau_j > alpha<-005 > mse<-065 > for(i in 1:(a-1)) + for(j in (i+1):a) + { + print( + c(tauihat[i]-tauihat[j]-qt(1-alpha/2,n-a-b+1)*sqrt(mse*2*k/(lambda*a)), + tauihat[i]-tauihat[j]+qt(1-alpha/2,n-a-b+1)*sqrt(mse*2*k/(lambda*a)))) + } [1] -2044811 1544811 [1] -2419811 1169811 [1] -5419811-1830189 [1] -2169811 1419811 [1] -5169811-1580189 [1] -4794811-1205189 Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 49/81

> #(1-alpha)100% Tukey CI for tau_i- tau_j > alpha<-005 > mse<-065 > for(i in 1:(a-1)) + for(j in (i+1):a) + { + print( + c(tauihat[i]-tauihat[j]-(qtukey(1-alpha,a,n-a-b+1)/sqrt(2)) + *sqrt(mse*2*k/(lambda*a)), + tauihat[i]-tauihat[j]+(qtukey(1-alpha,a,n-a-b+1)/sqrt(2)) + *sqrt(mse*2*k/(lambda*a)))) + } [1] -2826341 2326341 [1] -3201341 1951341 [1] -6201341-1048659 [1] -2951341 2201341 [1] -59513415-07986585 [1] -55763415-04236585 Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 50/81

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 51/81 Other incomplete block designs Youden square Partially balanced incomplete block design Cubic and rectangular Lattices Cyclic designs

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 52/81 33 Latin Square Designs Agronomy experiments: Suppose we want to test the relative effectiveness of 5 different fertilizer mixtures on oats The five experiments cannot be carried out on the same plot of land Even contiguous plots may vary in fertility because of a moisture gradient, different previous use of the land, or some other reasons Dividing a single plot into a 5 5 grid of subplots, and administering the fertilizers according to a Latin square arrangement as in the figure below:

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 53/81 Typewriters experiments: A company is interested in purchasing one brand of typewriter from among the 5 kinds available in the market To make decision, a study is performed to evaluate the typewriter It is suspected that the time of the day as well the day of the week in which the test is carried out affects the output on the machine Days Shifts 1 2 3 4 5 Total Treatments Mon 10 15 11 13 9 58 D B A C E Tue 10 12 16 10 12 60 E C B D A Wed 19 8 12 10 8 57 B E C A D Thu 9 12 10 14 12 57 A D E B C Fri 12 11 8 10 15 56 C A D E B Total 60 58 57 57 56 288

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 54/81 Example: A hardness testing machine presses a pointed rod (the tip ) into a metal specimen (a coupon ), with a known force The depth of the depression is a measure of the hardness of the specimen It is feared that, depending on the kind of tip used, the machine might give different readings The experimenter wants 4 observations on each of the 4 types of tips Suppose that the coupon and the operator of the testing machine are thought to be factors Suppose there are p = 4 operators, p = 4 coupons, and p = 4 tips The first two are nuisance factors, the last is the treatment factor Operator Coupon k = 1 k = 2 k = 3 k = 4 i = 1 A = 93 B = 93 C = 95 D = 102 i = 2 B = 94 A = 94 D = 10 C = 97 i = 3 C = 92 D = 96 A = 96 B = 99 i = 4 D = 97 C = 94 B = 98 A = 10

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 55/81 Definition Consider one treatment factor and two nuisance/blocking factors A design is called Latin square design if each treatment appears exactly once in each row and in each column The number of levels of each blocking factor must equal the number of levels of the treatment factor Small run sizes Randomization Randomly select a Latin square Randomize the experiment units and trial orders

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 56/81 Model y ijk = µ+α i +τ j +β k +ǫ ijk,i,j,k = 1,,p y ijk : the response in row i, column k using treatment j α i : row effect, i α i = 0 τ j : treatment effect, j τ j = 0 β k : column effect, k β k = 0 ǫ ijk iid N(0,σ 2 )

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 57/81 Estimation ˆµ = ȳ ˆα i = ȳ i ȳ ˆτ j = ȳ j ȳ ˆβ k = ȳ k ȳ r ijk = y ijk (ȳ i +ȳ j +ȳ k )+2ȳ

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 58/81 ANOVA table Define: SS Total = i (y ijk ȳ ) 2 j k SS Rows = p i (ȳ i ȳ ) 2 SS Treatments = p j (ȳ j ȳ ) 2 SS Columns = p k (ȳ k ȳ ) 2 SS Error = i [y ijk (ȳ i +ȳ j +ȳ k )+2ȳ ] 2 j k

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 59/81 Source Sum of Squares DO F Mean Squares F Treatments SS Treatments p 1 SS Treatments /(p 1) Rows SS Rows p 1 SS Rows /(p 1) Columns SS Columns p 1 SS Columns /(p 1) Error SS Error (p 2)(p 1) SS Error /[(p 2)(p 1)] Total SS Total p 2 1 MS Treatments MS Error Compare F to F α,p 1,(p 2)(p 1) to reject or accept H 0 : τ 1 = = τ p

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 60/81 > anova(g) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) tip 3 038500 012833 385 00002585 *** operator 3 082500 027500 825 2875e-05 *** coupon 3 006000 002000 60 00307958 * Residuals 6 002000 000333 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 61/81 Multiple comparisons If H 0 is rejected, multiple comparisons of τ i and τ j should be performed The test statistic is t ij = ȳi ȳ j ˆσ 1p + 1 p where ˆσ 2 is the mean square error in the ANOVA table Tukey multiple comparison method claims treatments i and j are statistically significantly different if t ij > 1 2 q α,p,(p 2)(p 1)

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 62/81 Application Crossover design is a type of randomized clinical trial Each participants in the design is randomized to either group 1 or group 2 All participants in group 1 receive drug A in the first treatment period and drug B in the second period All participants in group 2 receive drug B in the first treatment period and drug A in the second treatment period Often there is a washout period between the two active drug periods During the washout period, they receive no study medication The purpose of the washout period is to reduce the likelihood that study medication taken in the first period will have an effect that carries over the next period Latin Squares I II III IV V Subject 1 2 3 4 5 6 7 8 9 10 Period 1 A B B A B A A B A B Period 2 B A A B A B B A B A

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 63/81 Consider a clinical trial comparing Motrin versus placebo for the treatment of tennis elbow Each participant was randomized to receive either Motrin (group 1) or placebo (group 2) for a 3-week period All participants then had 2-week washout period during which they receive no study medication All participants were then crossed-over for a second 3-week period to receive the opposite study medication from that initially received ANOVA table for crossover design Source DOF Subjects (Columns) 9 Periods (Rows) 1 Treatments (Letters) 1 Error 18 Total 29

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 64/81 33 Graeco-Latin Squares Definition: Orthogonal Latin squares Two Latin squares are said to be orthogonal if each pair of letters appears exactly once in the superimposed squares The superimposed square is called Graeco-Latin square Aα Bβ Cγ Bγ Cα Aβ Cβ Aγ Bα

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 65/81 Model y ijkl = µ+θ i +τ j +ω k +φ l +ǫ ijkl,i,j,k,l = 1,,p y ijkl : the observation in row i and column l for Latin letter j and Greek letter k θ i : ith row effect τ j : jth Latin letter treatment effect ω k : kth Greek letter treatment effect φ l : lth column effect ǫ ijkl iid N(0,σ 2 )

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 66/81 ANOVA Table Source Sum of Squares DOF Rows p i (ȳ i ȳ ) 2 p 1 Latin letter treatments p j (ȳ j ȳ ) 2 p 1 Greek letter treatments p k (ȳ k ȳ ) 2 p 1 Columns p l (ȳ l ȳ ) 2 p 1 Error SS Error (by substraction) (p 3)(p 1) Total i j k l (y ijkl ȳ ) 2 p 2 1 F-test and Tukey s multiple comparison are similar as those in Latin square design

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 67/81 35 Analysis of Covariance (ANCOVA) Consider an experiment (Flurry, 1939) to study the breaking strength (y) in grams of three types of starch film The breaking strength is also known to depend on the thickness of the film (x) as measured in 10 4 inches Because film thickness varies from run to run and its values cannot be controlled or chosen prior to the experiment, it should be treated as a covariate whose effect on strength needs to be accounted for before comparing the three types of starch Objective: perform the treatment comparisons by incorporating the information of auxiliary covariate x

Data for starch experiment Canna Starch corn Potato y x y x y x 7917 77 7310 80 9833 130 6100 63 7100 73 9588 133 7100 86 6047 72 7478 107 9407 118 5088 61 8660 122 8627 117 9733 137 5925 72 Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 68/81

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 69/81 Model y ij = µ+τ i +γx ij +ǫ ij,i = 1,,k;j = 1,,n i where µ: overall mean τ i : ith treatment effect, k i=1 τ i = 0 or τ 1 = 0 x ij : the covariate value for y ij γ:: the regression coefficient for the covariate iid ǫ ij N(0,σ 2 ) Special cases a γx ij = 0, reduces to complete randomized design b τ i = 0, reduces to simple linear regression

Estimation Assume τ 1 = 0 We rewrite the model such that y = Xβ +ǫ where y = y 11 y 1n1 y k1 y knk, x = 1 0 0 0 0 x 11 1 1 0 0 0 0 x 1n1 1 1 0 0 0 x 21 1 1 1 0 0 0 x 2n2 1 0 0 0 1 x k1 1 1 0 0 0 1 x knk, β = µ τ 2 τ k γ, ǫ = ǫ 11 ǫ 1n1 ǫ k1 ǫ knk Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 70/81

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 71/81 We have ˆβ = (X T X) 1 X T y = ˆµ ˆτ 2 ˆτ kˆγ and thus we also obtain ˆτ i ˆτ j = ˆµ i ˆµ j

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 72/81 Hypothesis test H 0 : τ 1 = = τ k Model I: y ij = µ+γx ij +ǫ ij,i = 1,,k;j = 1,,n i Model II: y ij = µ+τ i +γx ij +ǫ ij,i = 1,,k;j = 1,,n i We have SS(Reg, Model I) = SS Total SS Error (Model I) SS Treatments = SS Error (Model I) SS Error (Model II)

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 73/81 ANOVA table Source Sum of Square DOF Mean Square F Covariate SS(Reg, Model I) 1 SS(Reg, Model I)/1 MS x /MS Error Treatments SS Treatments k 1 SS Treatments /(k 1) MS Treatments /MS Error Error SS Error (Model II) i n i 1 k MS Error Total SS Total i n i 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 74/81 Multiple Comparisons To compute Var(ˆτ i ˆτ j ), note that Var(ˆτ i ˆτ j ) = Var(ˆτ i )+Var(ˆτ j ) 2Cov(ˆτ i,ˆτ j ) Use the fact Var(ˆβ) = σ 2 (X T X) 1 in multiple regression Test statistic t ij = ˆτ i ˆτ j ˆ Var(ˆτ i ˆτ j )

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 75/81 > # set the model matrix > x<-matrix(0,n,4) > x[,1]<-rep(1,n) > x[14:32,2]<-1 > x[33:49,3]<-1 > x[,4]<-dataset[,2] > # fit the model > g<-lm(y x[,2]+x[,3]+x[,4])

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 76/81 > summary(g) Call: lm(formula = y x[, 2] + x[, 3] + x[, 4]) Coefficients: Estimate Std Error t value Pr(> t ) (Intercept) 15826 17978 0880 0383360 x[, 2] -8367 8610-0972 0336351 x[, 3] 7036 6778 1038 0304795 x[, 4] 6250 1706 3664 0000653 *** --- Signif codes: 0 *** 0001 ** 001 * 005 01 1 Residual standard error: 1647 on 45 degrees of freedom Multiple R-squared: 06815, Adjusted R-squared: 06602 F-statistic: 3209 on 3 and 45 DF, p-value: 3001e-11

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 77/81 Effect Estimate Standard Error t value p value intercept (µ) 15826 17978 0880 0383360 γ 6250 1706 3664 0000653 τ 2 τ 1-8367 8610-0972 0336351 τ 3 τ 1 7036 6778 1038 0304795

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 78/81 > starch<-vector("character",n) > starch[1:13]<-"a" > starch[14:32]<-"b" > starch[33:49]<-"c" > anova(lm(y x[,4]+starch)) #ANOVA table Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) x[, 4] 1 2553357 2553357 941859 1318e-12 *** starch 2 56725 28362 10462 03597 Residuals 45 1219940 27110 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 79/81 Incorrect analysis > anova(lm(y starch+x[,4])) #ANOVA table Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) starch 2 2246204 1123102 41428 6253e-11 *** x[, 4] 1 363878 363878 13422 00006526 *** Residuals 45 1219940 27110 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 80/81 > anova(lm(y starch)) #ANOVA table ignoring thickness Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) starch 2 2246204 1123102 32619 1512e-09 *** Residuals 46 1583818 34431 --- Signif codes: 0 *** 0001 ** 001 * 005 01 1

Week 3 & 4Randomized Blocks, Latin Squares, and Related Designs p 81/81 > solve(t(x)%*%x) [,1] [,2] [,3] [,4] [1,] 11921580-0477477360 0117011447-010941927 [2,] -04774774 0273420071 0007268421 003929967 [3,] 01170114 0007268421 0169470981-001902754 [4,] -01094193 0039299666-0019027538 001073548 > txxinv<-solve(t(x)%*%x) > sqrt(27110*(txxinv[2,2]+txxinv[3,3]-2*txxinv[2,3])) [1] 1077622