Outline Topic 21 - Two Factor ANOVA

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

SAS Commands. General Plan. Output. Construct scatterplot / interaction plot. Run full model

Outline. Topic 22 - Interaction in Two Factor ANOVA. Interaction Not Significant. General Plan

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

Topic 32: Two-Way Mixed Effects Model

Statistics 512: Applied Linear Models. Topic 7

Topic 28: Unequal Replication in Two-Way ANOVA

Topic 25 - One-Way Random Effects Models. Outline. Random Effects vs Fixed Effects. Data for One-way Random Effects Model. One-way Random effects

Statistics 512: Applied Linear Models. Topic 9

Topic 29: Three-Way ANOVA

Topic 20: Single Factor Analysis of Variance

Unbalanced Designs Mechanics. Estimate of σ 2 becomes weighted average of treatment combination sample variances.

Outline. Topic 19 - Inference. The Cell Means Model. Estimates. Inference for Means Differences in cell means Contrasts. STAT Fall 2013

STAT 705 Chapter 19: Two-way ANOVA

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

STAT Final Practice Problems

Factorial ANOVA. Psychology 3256

Analysis of Variance and Design of Experiments-I

iron retention (log) high Fe2+ medium Fe2+ high Fe3+ medium Fe3+ low Fe2+ low Fe3+ 2 Two-way ANOVA

MAT3378 ANOVA Summary

Two-Factor Full Factorial Design with Replications

Analysis of Covariance

Lecture 9: Factorial Design Montgomery: chapter 5

STAT 705 Chapter 19: Two-way ANOVA

Factorial and Unbalanced Analysis of Variance

Lecture 3. Experiments with a Single Factor: ANOVA Montgomery 3-1 through 3-3

Outline. Topic 20 - Diagnostics and Remedies. Residuals. Overview. Diagnostics Plots Residual checks Formal Tests. STAT Fall 2013

Chapter 1 Linear Regression with One Predictor

Ch. 5 Two-way ANOVA: Fixed effect model Equal sample sizes

Two-Way Factorial Designs

Lecture 3. Experiments with a Single Factor: ANOVA Montgomery 3.1 through 3.3

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

Chapter 2 Inferences in Simple Linear Regression

Factorial designs. Experiments

Two-Way Analysis of Variance - no interaction

3. Design Experiments and Variance Analysis

Statistics For Economics & Business

Comparison of a Population Means

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

One-Way Analysis of Variance (ANOVA) There are two key differences regarding the explanatory variable X.

Single Factor Experiments

TWO OR MORE RANDOM EFFECTS. The two-way complete model for two random effects:

Fractional Factorial Designs

Topic 18: Model Selection and Diagnostics

Homework 3 - Solution

Lecture 7: Latin Square and Related Design

STAT22200 Spring 2014 Chapter 8A

Two or more categorical predictors. 2.1 Two fixed effects

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

Lec 5: Factorial Experiment

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

Topic 23: Diagnostics and Remedies

Statistics for Managers Using Microsoft Excel Chapter 10 ANOVA and Other C-Sample Tests With Numerical Data

Lecture 7: Latin Squares and Related Designs

Analysis of Variance

Statistics 210 Part 3 Statistical Methods Hal S. Stern Department of Statistics University of California, Irvine

Overview Scatter Plot Example

Chapter 8 Quantitative and Qualitative Predictors

Chapter 10. Design of Experiments and Analysis of Variance

Example: Four levels of herbicide strength in an experiment on dry weight of treated plants.

Chapter 11. Analysis of Variance (One-Way)

STAT 506: Randomized complete block designs

T-test: means of Spock's judge versus all other judges 1 12:10 Wednesday, January 5, judge1 N Mean Std Dev Std Err Minimum Maximum

Topic 6. Two-way designs: Randomized Complete Block Design [ST&D Chapter 9 sections 9.1 to 9.7 (except 9.6) and section 15.8]

WITHIN-PARTICIPANT EXPERIMENTAL DESIGNS

The legacy of Sir Ronald A. Fisher. Fisher s three fundamental principles: local control, replication, and randomization.

One-way ANOVA (Single-Factor CRD)

Stat 511 HW#10 Spring 2003 (corrected)

Two-Way ANOVA (Two-Factor CRD)

STOR 455 STATISTICAL METHODS I

Assignment 6 Answer Keys

Ch 2: Simple Linear Regression

AN IMPROVEMENT TO THE ALIGNED RANK STATISTIC

STAT 705 Chapter 16: One-way ANOVA

n i n T Note: You can use the fact that t(.975; 10) = 2.228, t(.95; 10) = 1.813, t(.975; 12) = 2.179, t(.95; 12) =

CS 147: Computer Systems Performance Analysis

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

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

Chapter 20 : Two factor studies one case per treatment Chapter 21: Randomized complete block designs

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

Lecture 7 Randomized Complete Block Design (RCBD) [ST&D sections (except 9.6) and section 15.8]

Section 7.3 Nested Design for Models with Fixed Effects, Mixed Effects and Random Effects

Chapter 12. Analysis of variance

Lec 1: An Introduction to ANOVA

Summary of Chapter 7 (Sections ) and Chapter 8 (Section 8.1)

T.I.H.E. IT 233 Statistics and Probability: Sem. 1: 2013 ESTIMATION AND HYPOTHESIS TESTING OF TWO POPULATIONS

V. Experiments With Two Crossed Treatment Factors

Lecture 10: 2 k Factorial Design Montgomery: Chapter 6

STA 303H1F: Two-way Analysis of Variance Practice Problems

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

Lecture 2: Basic Concepts and Simple Comparative Experiments Montgomery: Chapter 2

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

Nested Designs & Random Effects

Stat 217 Final Exam. Name: May 1, 2002

Chapter 8: Hypothesis Testing Lecture 9: Likelihood ratio tests

1 Tomato yield example.

Multiple Sample Numerical Data

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

Lecture 3: Inference in SLR

Lecture 12: 2 k Factorial Design Montgomery: Chapter 6

Transcription:

Outline Topic 21 - Two Factor ANOVA Data Model Parameter Estimates - Fall 2013 Equal Sample Size One replicate per cell Unequal Sample size Topic 21 2 Overview Now have two factors (A and B) Suppose each factor has two levels Could analyze as one factor with 4 levels Trt 1: A high, B high Trt 2: A high, B low Trt 3: A low, B high Trt 4: A low, B low Use contrasts to test for main effects an interaction A main effect = Trt1 + Trt2 2 Trt3 + Trt4 2 Example An experiment is conducted to study the effect of hormones injected into test rats. There are two distinct hormones (A,B) each with two distinct levels. For purposes here, we will consider this to be four different treatments labeled {A,a,B,b}. Each treatment is applied to six rats with the response being the amount of glycogen (in mg) in the liver. Treatment Responses A 106 101 120 86 132 97 a 51 98 85 50 111 72 B 103 84 100 83 110 91 b 50 66 61 72 85 60 Topic 21 3 Topic 21 4

Example Three contrasts are of interest. They are: Two-way Factorial Comparison A a B b Hormone A vs Hormone B 1 1-1 -1 Low level vs High level 1-1 1-1 Equivalence of level effect 1-1 -1 1 Can we reanalyze the experiment in such a way that these sum of squares are already separated? Break up the treatments into the two factors Example also known as a 2 2 factorial Investigates all combos of factor levels Single replicate involves ab trials Topic 21 5 Topic 21 6 Two-way Factorial Layout Often presented as table or plot Level Hormone Low High A xxxxxx xxxxxx B xxxxxx xxxxxx Data for Two Factor ANOVA Y is the response variable Factor A has levels i = 1, 2,..., a Factor B has levels j = 1, 2,..., b Y ijk is the k th observation from cell (i, j) Hormone b a B A Chapter 19 assumes n ij = n Chapter 20 assumes n ij = 1 Level Chapter 23 allows n ij to vary Topic 21 7 Topic 21 8

Example Page 833 Castle Bakery supplies wrapped Italian bread to a large number of supermarkets Bakery interested in the set up of their store display Height of display shelf (top, middle, bottom) Width of display shelf (regular, wide) Twelve stores equal in sales volume were selected Randomly assigned equally to each of 6 combinations Y is the sales of the bread i = 1, 2, 3 and j = 1, 2 n ij = n = 2 SAS Commands data a1; infile u:\.www\datasets525\ch19ta07.txt ; input sales height width; proc print; run; data a1; set a1; if height eq 1 and width eq 1 then hw= 1_BR ; if height eq 1 and width eq 2 then hw= 2_BW ; if height eq 2 and width eq 1 then hw= 3_MR ; if height eq 2 and width eq 2 then hw= 4_MW ; if height eq 3 and width eq 1 then hw= 5_TR ; if height eq 3 and width eq 2 then hw= 6_TW ; symbol1 v=circle i=none; proc gplot data=a1; plot sales*hw/frame; Topic 21 9 Topic 21 10 Sales Data Scatterplot Obs sales height width 1 47 1 1 2 43 1 1 3 46 1 2 4 40 1 2 5 62 2 1 6 68 2 1 7 67 2 2 8 71 2 2 9 41 3 1 10 39 3 1 11 42 3 2 12 46 3 2 Topic 21 11 Topic 21 12

The Cell Means Model The Model Expressed mathematically Y ijk = µ ij + ε ijk All observations assumed independent All observations normally distributed with a mean that may depend on levels of factors A and B constant variance Often presented in terms of cell means or factor effects where µ ij is the theoretical mean or expected value of all observations in cell (i, j) The ε ijk are iid N(0,σ 2 ) which implies the Y ijk are independent N(µ ij,σ 2 ) Parameters {µ ij }, i = 1, 2,..,a, j = 1, 2,..., b σ 2 Topic 21 13 Topic 21 14 Estimates / Inference Estimate µ ij by the sample mean of the observations in cell (i, j) ˆµ ij = Y ij. Can also estimate variance using observations in cell (i, j) s 2 ij = (Y ijk Y ij. ) 2 /(n 1) These s 2 ij are combined for single estimate of σ 2 ANOVA Table : n ij = n Similar ANOVA table construction (Y ij. is fitted value) Source of Variation df SS Model ab 1 n (Y ij. Y... ) 2 Error ab(n 1) Total abn 1 Y... = Y ij. = (Yijk Y ij. ) 2 (Yijk Y... ) 2 Y ijk /abn Y ij. /n Can further break down into Factor A, Factor B and interaction effects using contrasts Topic 21 15 Topic 21 16

Factor Effects Model Breaks down cell means µ = i j µ ij /(ab) µ i. = j µ ij /b and µ.j = i µ ij /a α i = µ i. µ and β j = µ.j µ (αβ) ij = µ ij (µ + α i + β j ) Interaction effect is the difference between the cell mean and the additive or main effects model. Explains variation not explained by main effects. Statistical model is µ - grand mean Factor Effects Model Y ijk = µ + α i + β j + (αβ) ij + ε ijk α i - ith level effect of factor A (ignores B) β j - jth level effect of factor B (ignores A) (αβ) ij - interaction effect of combination ij i = 1, 2,..., a j = 1, 2,..., b k = 1, 2,..., n Like one-way model this is over-parameterized. Must include a + b + 1 model constraints. i α i = 0 j β j = 0 i (αβ) ij = 0 j (αβ) ij = 0 Topic 21 17 Topic 21 18 Factor Effects Estimates Constraints on previous page result in µ = Y... α i = Y i.. Y... β j = Y.j. Y... (αβ) ij = Y ij. Y i.. Y.j. + Y... The predicted value and residual are Ŷ ijk = Y ij. e ijk = Y ijk Y ij. Questions about our Example Does the height of the display affect sales? If yes, will need to do pairwise comparisons Does the width of the display affect sales? If yes, will need to do pairwise comparisons Does the effect of height depend on the width? Does the effect of width depend on the height? If yes to either of these last two, we have an interaction Topic 21 19 Topic 21 20

Partitioning the Sum of Squares Y ijk Y... = (Y i.. Y... ) + (Y.j. Y... ) + (Y ij. Y i.. Y.j. + Y... ) + (Y ijk Y ij. ) Consider (Y ijk Y... ) 2 Right hand side simplifies to bn an n i j i (Y i.. Y... ) 2 + (Y.j. Y... ) 2 + j i j k (Y ij. Y i.. Y.j. + Y... ) 2 + (Y ijk Y ij. ) 2 Partitioning the Sum of Squares Can be written as SSTO = SSA + SSB + SSAB + SSE Degrees of freedom also broken down Under normality, all SS/σ 2 independent Source of Sum of Degrees of Mean Variation Squares Freedom Square Factor A SSA a 1 MSA Factor B SSB b 1 MSB Interaction SSAB (a 1)(b 1) MSAB Error SSE ab(n 1) MSE Total SSTO abn 1 Topic 21 21 Topic 21 22 Can show: Fixed Case E(MSE)=σ 2 Hypothesis Testing E(MSA) = σ 2 + bn α 2 i /(a 1) E(MSB) = σ 2 + an βj 2 /(b 1) E(MSAB) = σ 2 + n (αβ) 2 ij /(a 1)(b 1) Use F-test to test for A, B, and AB effects F = F = F = SSA/(a 1) SSE/(ab(n 1)) SSB/(b 1) SSE/(ab(n 1)) SSAB/(a 1)(b 1) SSE/(ab(n 1)) Topic 21 23 SAS Commands proc glm data=a1; class height width; model sales=height width height*width; means height width height*width; proc means data=a1; var sales; by height width; output out=a2 mean=avsales; symbol1 v=square i=join c=black; symbol2 v=diamond i=join c=black; proc gplot data=a2; plot avsales*height=width/frame; run; Topic 21 24

Output Output The GLM Procedure Class Level Information Class Levels Values height 3 1 2 3 width 2 1 2 Number of observations 12 Sum of Source DF Squares Mean Square F Value Pr > F Model 5 1580.000000 316.000000 30.58 0.0003 Error 6 62.000000 10.333333 Corrected Total 11 1642.000000 R-Square Coeff Var Root MSE sales Mean 0.962241 6.303040 3.214550 51.00000 Source DF Type I SS Mean Square F Value Pr > F height 2 1544.000000 772.000000 74.71 <.0001 width 1 12.000000 12.000000 1.16 0.3226 height*width 2 24.000000 12.000000 1.16 0.3747 Source DF Type III SS Mean Square F Value Pr > F height 2 1544.000000 772.000000 74.71 <.0001 width 1 12.000000 12.000000 1.16 0.3226 height*width 2 24.000000 12.000000 1.16 0.3747 Topic 21 25 Level of ------------sales------------ height N Mean Std Dev 1 4 44.0000000 3.16227766 2 4 67.0000000 3.74165739 3 4 42.0000000 2.94392029 Level of ------------sales------------ width N Mean Std Dev 1 6 50.0000000 12.0664825 2 6 52.0000000 13.4313067 Level of Level of ------------sales------------ height width N Mean Std Dev 1 1 2 45.0000000 2.82842712 1 2 2 43.0000000 4.24264069 2 1 2 65.0000000 4.24264069 2 2 2 69.0000000 2.82842712 3 1 2 40.0000000 1.41421356 3 2 2 44.0000000 2.82842712 Topic 21 26 Interaction Plot SAS Commands proc glm data=a1; class height width; model sales=height width; means height / tukey lines; proc glm data=a1; class height width; model sales=height width; means height / tukey lines; run; Topic 21 27 Topic 21 28

Results There appears to be no interaction between height and width (P=0.37) The effect of width (or height) is the same regardless of height (or width). Because of this, we can focus on the main effects (averages out the other effect). The main effect for width is not statistically significant (P=0.32) Width does not affect sales of bread The main effect for height is statistically significant (P < 0.0001). From the scatterplot and interaction plot, it appears the middle location is better than the top and bottom. Pairwise testing (adjusting for multiple comparisons) can confirm this. Pooling Insignificant Terms Some argue that an insignificant interaction should be dropped from the model (i.e., pooled with error) See last GLM call SSE = SSE + SSAB df E = ab(n 1) + (a 1)(b 1) This increases DF but could inflate ˆσ 2 Possibly result in a Type II error Rule of thumb: Only pool when dfe small (e.g., < 5) and P-value of the interaction is large (e.g., > 0.25) Topic 21 29 Topic 21 30 Tukey s Studentized Range (HSD) Test for sales Error Degrees of Freedom 6 Error Mean Square 10.33333 Critical Value of Studentized Range 4.33902 Minimum Significant Difference 6.974 Output Mean N height A 67.000 4 2 B 44.000 4 1 B B 42.000 4 3 **** POOLING **** Error Degrees of Freedom 8 Error Mean Square 10.75 Critical Value of Studentized Range 4.04101 Minimum Significant Difference 6.6247 KNNL Chapter 19 knnl833.sas Background Reading Mean N height A 67.000 4 2 B 44.000 4 1 B B 42.000 4 3 Topic 21 31 Topic 21 32