Chapter 6 Randomized Block Design Two Factor ANOVA Interaction in ANOVA

Similar documents
Two-Way Analysis of Variance - no interaction

CS 147: Computer Systems Performance Analysis

Allow the investigation of the effects of a number of variables on some response

Fractional Factorial Designs

Factorial ANOVA. Psychology 3256

Unbalanced Data in Factorials Types I, II, III SS Part 1

Orthogonal contrasts for a 2x2 factorial design Example p130

(Where does Ch. 7 on comparing 2 means or 2 proportions fit into this?)

Two-Factor Full Factorial Design with Replications

Chapter 15: Analysis of Variance

Topic 9: Factorial treatment structures. Introduction. Terminology. Example of a 2x2 factorial

Lecture notes 13: ANOVA (a.k.a. Analysis of Variance)

Multiple Regression. Inference for Multiple Regression and A Case Study. IPS Chapters 11.1 and W.H. Freeman and Company

In a one-way ANOVA, the total sums of squares among observations is partitioned into two components: Sums of squares represent:

Chapter 11 - Lecture 1 Single Factor ANOVA

CS 5014: Research Methods in Computer Science

Example - Alfalfa (11.6.1) Lecture 16 - ANOVA cont. Alfalfa Hypotheses. Treatment Effect

Lecture 15 - ANOVA cont.

Two Factor Full Factorial Design with Replications

ANOVA Randomized Block Design

16.3 One-Way ANOVA: The Procedure

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

STAT 115:Experimental Designs

Example - Alfalfa (11.6.1) Lecture 14 - ANOVA cont. Alfalfa Hypotheses. Treatment Effect

Econ 3790: Business and Economic Statistics. Instructor: Yogesh Uppal

MAT3378 ANOVA Summary

Two or more categorical predictors. 2.1 Two fixed effects

STAT 705 Chapter 19: Two-way ANOVA

This document contains 3 sets of practice problems.

y response variable x 1, x 2,, x k -- a set of explanatory variables

Wolf River. Lecture 19 - ANOVA. Exploratory analysis. Wolf River - Data. Sta 111. June 11, 2014

Two-Way Factorial Designs

Multiple Predictor Variables: ANOVA

Lecture 18 MA Applied Statistics II D 2004

ANOVA: Analysis of Variation

Statistics For Economics & Business

Key Features: More than one type of experimental unit and more than one randomization.

Biostatistics 380 Multiple Regression 1. Multiple Regression

Design of Experiments. Factorial experiments require a lot of resources

If we have many sets of populations, we may compare the means of populations in each set with one experiment.

STAT 705 Chapter 19: Two-way ANOVA

STAT22200 Spring 2014 Chapter 8A

AMS 315/576 Lecture Notes. Chapter 11. Simple Linear Regression

Chap The McGraw-Hill Companies, Inc. All rights reserved.

3. Design Experiments and Variance Analysis

CS 5014: Research Methods in Computer Science. Experimental Design. Potential Pitfalls. One-Factor (Again) Clifford A. Shaffer.

1 Introduction to One-way ANOVA

Increasing precision by partitioning the error sum of squares: Blocking: SSE (CRD) à SSB + SSE (RCBD) Contrasts: SST à (t 1) orthogonal contrasts

Outline Topic 21 - Two Factor ANOVA

Topic 17 - Single Factor Analysis of Variance. Outline. One-way ANOVA. The Data / Notation. One way ANOVA Cell means model Factor effects model

Ch. 1: Data and Distributions

1-Way ANOVA MATH 143. Spring Department of Mathematics and Statistics Calvin College

Unbalanced Data in Factorials Types I, II, III SS Part 2

Analysis of Variance and Design of Experiments-I

Statistiek II. John Nerbonne. March 17, Dept of Information Science incl. important reworkings by Harmut Fitz

Chapter 11 - Lecture 1 Single Factor ANOVA

df=degrees of freedom = n - 1

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

Unit 27 One-Way Analysis of Variance

Simple, Marginal, and Interaction Effects in General Linear Models

Confidence Interval for the mean response

Chapter 11: Factorial Designs

STAT22200 Spring 2014 Chapter 13B

1 Use of indicator random variables. (Chapter 8)

Inference for Regression

STAT22200 Spring 2014 Chapter 14

Variance Decomposition and Goodness of Fit

Lecture 1 Linear Regression with One Predictor Variable.p2

Stats fest Analysis of variance. Single factor ANOVA. Aims. Single factor ANOVA. Data

Inference for Regression Simple Linear Regression

Model Building Chap 5 p251

Variance Decomposition in Regression James M. Murray, Ph.D. University of Wisconsin - La Crosse Updated: October 04, 2017

Nested 2-Way ANOVA as Linear Models - Unbalanced Example

What If There Are More Than. Two Factor Levels?

Topic 20: Single Factor Analysis of Variance

Theorem A: Expectations of Sums of Squares Under the two-way ANOVA model, E(X i X) 2 = (µ i µ) 2 + n 1 n σ2

ST430 Exam 2 Solutions

Correlation and the Analysis of Variance Approach to Simple Linear Regression

Analysis of Variance (ANOVA)

Analysis of Variance. Contents. 1 Analysis of Variance. 1.1 Review. Anthony Tanbakuchi Department of Mathematics Pima Community College

Notes for Week 13 Analysis of Variance (ANOVA) continued WEEK 13 page 1

Multiple Linear Regression

The One-Way Repeated-Measures ANOVA. (For Within-Subjects Designs)

Week 14 Comparing k(> 2) Populations

Chapter 10. Design of Experiments and Analysis of Variance

DESAIN EKSPERIMEN Analysis of Variances (ANOVA) Semester Genap 2017/2018 Jurusan Teknik Industri Universitas Brawijaya

Lecture 15 Topic 11: Unbalanced Designs (missing data)

Two-factor studies. STAT 525 Chapter 19 and 20. Professor Olga Vitek

One-Way ANOVA Cohen Chapter 12 EDUC/PSY 6600

Analysis of Variance

3. Factorial Experiments (Ch.5. Factorial Experiments)

STAT Chapter 10: Analysis of Variance

STA441: Spring Multiple Regression. This slide show is a free open source document. See the last slide for copyright information.

MSc / PhD Course Advanced Biostatistics. dr. P. Nazarov

Grant MacEwan University STAT 252 Dr. Karen Buro Formula Sheet

Extensions of One-Way ANOVA.

9. Linear Regression and Correlation

Analysis of Bivariate Data

Multiple Regression: Chapter 13. July 24, 2015

Definitions of terms and examples. Experimental Design. Sampling versus experiments. For each experimental unit, measures of the variables of

Transcription:

Chapter 6 Randomized Block Design Two Factor ANOVA Interaction in ANOVA

Two factor (two way) ANOVA Two factor ANOVA is used when: Y is a quantitative response variable There are two categorical explanatory variables, called Factors: Factor A has K levels, k = 1,, K Factor B has J levels, j = 1,, J The combination of level k for A and level j for B has sample size n kj but if all equal, just use n. Use N for overall sample size.

Special case: Using BLOCKS Definition: A block is a group of similar units, or the same unit measured multiple times. Blocks are used to reduce known sources of variability, by comparing levels of a factor within blocks. Examples (explained in detail in class): Factor = 3 methods of reducing blood pressure; Blocks defined using initial blood pressure. Factor = 4 methods for enhancing memory; Blocks defined by age. Factor = Impairment while driving (alcohol, marijuana, no sleep, control); Blocks = individuals.

Simple Block Design, all n kj = 1 A simple block design has two factors with: Exactly one data value (observation) in each combination of the factors. Factor A is factor of interest, called treatment Factor B, called blocks, used to control a known source of variability Main interest is comparing levels of the treatment. Notation: Factor A (Treatments) has K levels Factor B (Blocks) has J levels N = KJ data values

Exam #1: Exam #2: Exam #3: Exam #4: Example: Do Means Differ for 4 Exam Formats? Adam Brenda Cathy Dave Emily 62 94 68 86 50 87 95 93 97 63 74 86 82 70 28 77 89 73 79 47 Mean 75 91 79 83 47 Treatments: 4 different exam formats, Blocks: 5 different students Question: Is there a difference in population means for the 4 exams? Mean 72 87 68 73 75 Use students as blocks because we know student abilities differ. Controls for that known source of variability.

Two way ANOVA: Main Effects Model Shown here for simple block design Y k j Grand mean Effect for k th treatment Effect for j th block Random error Mean of all exams for all students How mean for k th exam differs from overall mean How mean for j th student differs from overall mean

Randomized Block Calculations 1. Find the mean for each treatment (row means), each block (column means), and grand mean. 2. Partition the SSTotal into three pieces: SSTotal SSA SSB SSE SSTotal SSA SSB SSE 2 ( y y) ( n 1) sy J ( y y) K( y y) SSTotal k j 2 SSA 2 2 (As usual) Compare row means (exams) Compare column means (students) SSB (Unexplained error)

Randomized Block ANOVA Table Source d.f. S.S. M.S. t.s. p-value Trts = A Blocks Error Total K-1 SSTr SSTr/(K-1) J-1 SSB SSB/(J-1) MSB/MSE SSE SSE/(K-1)(J-1) N-1 SSTotal (K-1)(J-1) Testing TWO hypotheses: H 0 : α 1 = α 2 =... = α K = 0 H a : Some α k 0 H 0 : β 1 = β 2 =... = β J = 0 H a : Some β j 0 MSTr/MSE (Factor A: Difference in treatment means) (Factor B: Difference in block means)

ANOVA Output in R > BlockMod=aov(Grade~as.factor(Exam)+Student) > summary(blockmod) Df Sum Sq Mean Sq F value Pr(>F) as.factor(exam) 3 1030 343.33 5.7222 0.01144 * Student 4 4480 1120.00 18.6667 4.347e-05 *** Residuals 12 720 60.00 What if we ignored Blocks (Students) and treated it as a one-factor ANOVA? (See Lecture 15 didn t take into account blocks!) > model=aov(grade~as.factor(exam)) > summary(model) Df Sum Sq Mean Sq F value Pr(>F) as.factor(exam) 3 1030.0 343.3 1.0564 0.395 Residuals 16 5200.0 325.0 Ignoring student effect, exams don t seem to differ; but including student effect, exams do differ. SS(Student) becomes part of SSE if Blocks are ignored, which inflates the estimate of the standard deviation.

After Installing Three Packages in R: gplots, gdata, gtools > plotmeans(grade~exam) > plotmeans(grade~student) Grade 40 50 60 70 80 90 100 n=5 n=5 n=5 n=5 Grade 40 60 80 100 n=4 n=4 n=4 n=4 n=4 1 2 3 4 Adam Cathy Emily Exam Student 95% CI s for each group mean are shown in blue.

Fisher s LSD CIs After Two Way ANOVA in a Simple Block Design Same as one-way, but we know that 1 n i 1 n j 2 2 J K for row means for column means For treatment (row) means: LSD t * MSE 2 J For block (column) means: LSD t * MSE 2 K

Two way ANOVA model with Interaction Y k j kj Grand mean Main effect for Factor A Interaction effect Random error Main effect for Factor B

What s an Interaction Effect? An interaction effect occurs when differences in mean level effects for one factor depend on the level of the other factor. Example: Y = GPA Factor A = Year in School (FY, So, Jr, Sr) Factor B = Major (Psych, Bio, Math) FY is hard. Bio is easy. Jr in Math is harder than just Jr or just Math α 1 < 0 (Main effect) β 2 > 0 (Main effect) γ 33 < 0 (Interaction effect)

Example Fire extinguishers tested to see how quickly they put out fires. Factor A: 3 different chemicals in the extinguishers A 1, A 2, A 3 Factor B: 2 types of fires, B 1 = wood, B 2 = gas Y kj = time to put out the fire of type B j with chemical A k Questions of interest: Do the 3 chemicals differ in mean time required? (If so, there is a Factor A effect.) Does mean time to put out fire depend on the type of fire? (If so, there is a Factor B effect.) Do the differences in times for the 3 chemicals depend on the type of fire? (If so, there is an interaction between chemical type and fire type.)

Example: Putting out fires Factor A: Chemical (A 1, A 2, A 3 ) Factor B: Fire type (wood, gas) Response: Time until fire is completely out (in seconds) Data: Wood (j=1) Gas (j=2) A1 (k=1) 52 64 72 60 A2 (k=2) 67 55 78 68 K = 3 J = 2 n = 2 N = 12 A3 (k=3) 86 72 43 51

Interpreting Interaction Graphical: Cell means plot (Interaction plot) Data: Wood Gas A1 58.0 66.0 A2 61.0 73.0 A3 79.0 47.0

Interaction Plot via R Generic > interaction.plot(factora,factorb,y) > interaction.plot(chemical,type,time) OR > interaction.plot(type,chemical, Time)

> interaction.plot(type,chemical,time) mean of Time 50 60 70 80 Chemical A3 A2 A1 Levels of Factor A (Chemical) Gas Wood Type Levels of Factor B (Type of Fire) Interpretation discussed in class.

> interaction.plot(chemical,type,time) mean of Time 50 60 70 80 A1 A2 A3 Type Wood Gas Levels of Factor B (Type of Fire) Chemical Levels of Factor A (Chemical) Interpretation discussed in class.

Two way ANOVA (with Interaction) Y k j kj Grand mean Main effect for Factor A Interaction effect Random error Main effect for Factor B

Generic Interaction Plots: 7 Cases Suppose A has three levels and B has two levels. Grand mean only (no treatment effects) Y

Treatment A Effect, No Treatment B Effect Y k Means differ for levels of A, not for levels of B.

Treatment B Effect, No Treatment A Effect Y j Means differ for levels of B, not for levels of A.

Treatments A and B Have Effects, No Interaction Y k j Differences between the 2 levels of Factor B don t depend on level of Factor A (and vice versa).

A and B Effects Plus Interaction Y k j kj

No A Effect but a B Effect Plus Interaction Y j kj Cannot say means of A do not differ! They do, at each level of B.

A Effect but No B Effect Plus Interaction Y k kj Cannot say means of B do not differ! They do, at each level of A.

mean of Time 50 60 70 80 A1 A2 A3 Type Wood Gas Looks like a significant interaction No interaction: lines would be parallel. Chemical However, looks like almost no overall A effect or B effect! Interaction: Differences in A depend on level of B.

Chapter 6 Section 6.3 The Gory Details!

Recall: Main Effects Model Y k j Grand Mean Effect for k th level of Factor A Effect for j th level of Factor B Random error

Factorial Anova Example: Putting out fires Factor A: Chemical (A1, A2, A3) Factor B: Fire type (wood, gas) Response: Time required to put out fire (seconds) Data: Wood Gas A1 52 64 72 60 A2 67 55 78 68 A3 86 72 43 51 Row mean 62 67 63 Col mean 66 62

Two way ANOVA (with Interaction) Y k j kj Grand mean Main effect for Factor A Interaction effect Random error Main effect for Factor B

Factorial Design Assume: Factor A has K levels, Factor B has J levels. To estimate an interaction effect, we need more than one observation for each combination of factors. Let n kj = sample size in (k,j) th cell. Definition: For a balanced design, n kj is constant for all cells. n kj = n n = 1 in a typical randomized block design n > 1 in a balanced factorial design

Fire Extinguishers Factor A: Chemical (A1, A2, A3) Factor B: Fire type (wood, gas) Response: Time required to put out fire (seconds) Data: Wood Gas A1 52 64 72 60 A2 67 55 78 68 K = 3 J = 2 n = 2 N = 12 A3 86 72 43 51

Estimating Factorial Effects y kj y j mean for ( k, mean for j th j) th cell column y mean for k k th row y Grand mean y k j kj ( y y) ( yk y) ( y j y) ( ykj yk y j y) ( y ykj ) Total = Factor A + Factor B + Interaction + Error SSTotal = SSA + SSB + SSAB + SSE

Partitioning Variability (Balanced) SSTotal ( y y) 2 ( N 1) s 2 Y SSA Jn( y y) 2 k k SSB Kn( y y) j SSAB n( y y y y) SSE j kj k j k, j y y 2 kj 2 (As usual) (Row means) (Column means) SSTotal SSA SSB SSAB 2 (Cell means) SSTotal SSA SSB SSAB SSE (Error) Total = Factor A + Factor B + Interaction + Error

Decomposition: Fire extinguishers Data: Wood Gas A1 52 64 72 60 A2 67 55 78 68 A3 86 72 43 51

Cell Means: Wood Gas Row mean Trt A effect A1 58.0 66.0 62 2 A2 61.0 73.0 67 +3 A3 79.0 47.0 63 1 Col mean 66 62 64 Trt B effect +2 2

Interaction effects Wood Gas Row mean Trt A effect A1 6 6 62 2 A2 8 8 67 +3 A3 14 14 63 1 Col mean 66 62 64 Trt B effect +2 2 58 66 62 + 64 = 6

Decomposition: Fire Extinguishers Top left cell: 52,64 Top right cell: 72,60 Observed Value Grand Mean Trt A Effect Trt B Effect Interaction Residual 52 = 64 + -2 + 2 + -6 + -6 64 = 64 + -2 + 2 + -6 + 6 72 = 64 + -2 + -2 + 6 + 6 60 = 64 + -2 + -2 + 6 + -6 Etc.

Two way ANOVA Table (with Interaction) Source d.f. S.S. M.S. t.s. p Factor A K 1 SSA SSA/(K 1) MSA/MSE Factor B J 1 SSB SSB/(J 1) MSB/MSE A B (K 1)(J 1) SSAB SSAB/df MSAB/MSE Error KJ(n 1) SSE SSE/df Total N 1 SSY H 0 : α 1 = α 2 =... = α K = 0 H 0 : β 1 = β 2 =... = β J = 0 H 0 : All γ kj = 0

(Looking back) If n = 1 then df(interaction) = 0 Recall: Randomized Block ANOVA Table Source d.f. S.S. M.S. t.s. p-value Trts/A Block Error Total K 1 J 1 (K 1) (J 1) N 1 SSTr SSB SSE SSTotal SSTr/(K 1) SSB/(J 1) SSE/(K 1)(J 1) MSTr/MSE MSB/MSE

Fire Example: Two way ANOVA Table, with Interaction Source d.f. S.S. M.S. t.s. p Chemical 2 56 28.0 0.42 0.672 Type 1 48 48.0 0.73 0.426 A B 2 1184 592.0 8.97 0.016 Error 6 396 66.0 Total 11 1684 H 0 : α 1 = α 2 =... = α K = 0 H 0 : β 1 = β 2 =... = β J = 0 H 0 : All γ kj = 0

Two way ANOVA with R Option #1 aov > model=aov(time~chemical+type+chemical:type) > summary(model) Df Sum Sq Mean Sq F value Pr(>F) Chemical 2 56 28 0.424 0.6725 Type 1 48 48 0.727 0.4265 Chemical:Type 2 1184 592 8.970 0.0157 * Residuals 6 396 66

Two way ANOVA with R Option #2 anova(lm), when predictors are categorical > anova(lm(time~chemical+type+chemical:type)) Analysis of Variance Table Response: Time Df Sum Sq Mean Sq F value Pr(>F) Chemical 2 56 28 0.4242 0.67247 Type 1 48 48 0.7273 0.42649 Chemical:Type 2 1184 592 8.9697 0.01574 * Residuals 6 396 66

If sample sizes are not equal, order matters. New example (on website): Y = GPA Explanatory variables are: Seat location (front, middle, back) Alcohol consumption (none, some, lots)