Two-Way ANOVA (Two-Factor CRD)

Similar documents
One-way ANOVA (Single-Factor CRD)

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

Outline Topic 21 - Two Factor ANOVA

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

SAS Program Part 1: proc import datafile="y:\iowa_classes\stat_5201_design\examples\2-23_drillspeed_feed\mont_5-7.csv" out=ds dbms=csv replace; run;

Two-Way Factorial Designs

Mixed Model: Split plot with two whole-plot factors, one split-plot factor, and CRD at the whole-plot level (e.g. fancier split-plot p.

Lecture 9: Factorial Design Montgomery: chapter 5

Lecture 7: Latin Square and Related Design

STAT22200 Spring 2014 Chapter 8A

Stat 217 Final Exam. Name: May 1, 2002

Lecture 11: Nested and Split-Plot Designs

Analysis of Covariance

Nested Designs & Random Effects

Analysis of Variance and Design of Experiments-I

Practice Final Exam. December 14, 2009

Lecture 7: Latin Squares and Related Designs

Lec 5: Factorial Experiment

Design & Analysis of Experiments 7E 2009 Montgomery

One-way ANOVA Model Assumptions

Chapter 12. Analysis of variance

The Random Effects Model Introduction

Factorial and Unbalanced Analysis of Variance

Ch 2: Simple Linear Regression

Two-Way Analysis of Variance - no interaction

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

Ch 3: Multiple Linear Regression

STAT 705 Chapter 16: One-way ANOVA

Factorial designs. Experiments

Analysis of Variance

Reference: Chapter 14 of Montgomery (8e)

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

Answer Keys to Homework#10

TWO-LEVEL FACTORIAL EXPERIMENTS: BLOCKING. Upper-case letters are associated with factors, or regressors of factorial effects, e.g.

Assignment 9 Answer Keys

STAT 705 Chapter 19: Two-way ANOVA

The factors in higher-way ANOVAs can again be considered fixed or random, depending on the context of the study. For each factor:

STAT 705 Chapter 19: Two-way ANOVA

Factorial Treatment Structure: Part I. Lukas Meier, Seminar für Statistik

Solution to Final Exam

K. Model Diagnostics. residuals ˆɛ ij = Y ij ˆµ i N = Y ij Ȳ i semi-studentized residuals ω ij = ˆɛ ij. studentized deleted residuals ɛ ij =

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

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

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

STAT 3A03 Applied Regression With SAS Fall 2017

STAT 430 (Fall 2017): Tutorial 8

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

6 Designs with Split Plots

Note: The problem numbering below may not reflect actual numbering in DGE.

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

Stat 601 The Design of Experiments

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

STAT 506: Randomized complete block designs

STAT 115:Experimental Designs

Linear models and their mathematical foundations: Simple linear regression

Single Factor Experiments

Lecture 14 Topic 10: ANOVA models for random and mixed effects. Fixed and Random Models in One-way Classification Experiments

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

Simple Linear Regression

These are multifactor experiments that have

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

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

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

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

COMPLETELY RANDOM DESIGN (CRD) -Design can be used when experimental units are essentially homogeneous.

Factorial BG ANOVA. Psy 420 Ainsworth

ERRATA FOR THE OTT/LONGNECKER BOOK AN INTRODUCTION TO STATISTICAL METHODS AND DATA ANALYSIS (3rd printing)

Power & Sample Size Calculation

ECON3150/4150 Spring 2016

Statistics 512: Applied Linear Models. Topic 9

Linear regression. We have that the estimated mean in linear regression is. ˆµ Y X=x = ˆβ 0 + ˆβ 1 x. The standard error of ˆµ Y X=x is.

Mixed Model: Split plot with two whole-plot factors, one split-plot factor, and CRD at the whole-plot level (e.g. fancier split-plot p.

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

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...

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

Stat 579: Generalized Linear Models and Extensions

Nesting and Mixed Effects: Part I. Lukas Meier, Seminar für Statistik

Lecture 4. Random Effects in Completely Randomized Design

Stat 6640 Solution to Midterm #2

Topic 29: Three-Way ANOVA

Chapter 13 Experiments with Random Factors Solutions

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

STAT 525 Fall Final exam. Tuesday December 14, 2010

Statistics 512: Applied Linear Models. Topic 7

Analysis of Covariance

Latin square designs are special block designs with two blocking factors and only one treatment per block instead of every treatment per block.

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

22s:152 Applied Linear Regression. Chapter 5: Ordinary Least Squares Regression. Part 1: Simple Linear Regression Introduction and Estimation

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

Lecture 3: Inference in SLR

Residual Analysis for two-way ANOVA The twoway model with K replicates, including interaction,

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

Topic 20: Single Factor Analysis of Variance

^l,2-, 3. f 2_ ' >v., 4. b/-e. of- fee. -^3-5- I70(fa = )&*>$)

Multiple Linear Regression

Confidence Intervals, Testing and ANOVA Summary

Stat 579: Generalized Linear Models and Extensions

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

3. Design Experiments and Variance Analysis

Correlation and the Analysis of Variance Approach to Simple Linear Regression

Transcription:

Two-Way ANOVA (Two-Factor CRD) STAT:5201 Week 5: Lecture 1 1 / 29

Factorial Treatment Structure A factorial treatment structure is simply the case where treatments are created by combining factors. We can generically refer to the factors with letters like A, B, C, etc. and the number of levels in are a, b, c, etc. A two-factor factorial has g = ab treatments, a three-factor factorial has g = abc treatments and so forth. We have a completely randomized design with N total number of experiment units. As mentioned earlier, we can think of factorials as a 1-way ANOVA with a single superfactor (levels as the treatments), but in most cases, it is beneficial to consider the factorial nature of the design. 2 / 29

Two-Way ANOVA (Factorial): Balanced Design Two factors: A with a levels, and B with b levels. g = a b treatments altogether, where the treatments are the combinations of the levels of the two factors. Completely randomized design with treatments randomly assigned to the g treatments. No blocking. No nesting. Example (Factors of DayLength and Climate with a = b = 2) Four treatments arising from the combination of the two factors g = 4. Treatments randomly assigned to hamsters, with two hamsters in each treatment cell or n i = 4 for all i, and N = 8. DayLength long short Climate cold warm 3 / 29

Two-Way ANOVA: Balanced Design Full Model (includes interaction): Y ijk = µ + α i + β j + (αβ) ij + ɛ ijk with ɛ ijk iid N(0, σ 2 ) for i = 1,..., a and j = 1,..., b and k = 1,..., n Total number of observations N = nab. As with the 1-way ANOVA effects model, we have an overparameterization (we have 1 + a + b + ab parameters for the mean structure, but only ab distinct groups), so we need constraints to make the parameters interpretable. Sum-to-zero restrictions on parameters: 0 = a α i = i=1 b β j = j=1 a (αβ) ij = i=1 b (αβ) ij j=1 4 / 29

Two-Way ANOVA: Balanced Design Full Model (includes interaction): Y ijk = µ + α i + β j + (αβ) ij + ɛ ijk with ɛ ijk iid N(0, σ 2 ) for i = 1,..., a and j = 1,..., b and k = 1,..., n Parameters α i, β j and (αβ) ij are fixed, unknown constants. The sum-to-zero restrictions give µ as the overall mean, or the expected value of response averaged across all treatments. The term α i is called the main effect of A at level i. The term β j is called the main effect of B at level j. The term (αβ) ij is the interaction effect of A and B in the ij treatment. The interaction effect is a measure of how far the treatment mean differs from the additive model. If all (αβ) ij = 0, then we are reduced to the additive model. 5 / 29

Two-Way ANOVA: Balanced Design Example (Animal-fattening experiment) Two primary factors: Vitamin B12 (0mg, 5mg) & Antibiotics (0mg, 40mg) Three animals randomly assigned to each of 4 treatments. Response was weight gain in lbs/week. Because we can not assume that the two factors do not interact, we should include interaction in the model. G.W. Cobb (1998). Introduction to Design & Analysis of Experiments. 6 / 29

Two-WayGtANOVA: z 5 (. '2. 2 Balanced I.S-f '-,."J Design ~ i3f< ' Example (Animal Fattening example) ~/~ 8(L ~;:b'~h( J 0 0 2 0 0 3 0 0 Lj 0 <.fo S- D yo fo 0 40 ":J- '5 o Y S- O ~ S- (o 0 5" 40 l~ C;; L{D /2- - ) L(O #~ (r~{c;or An fl'bld?'c W(,&hi- ) ~GU/\. C Ibs/Uld,.30 (. I ~ I. Do /.0,:) it o 0 l. 0 r- I I 2lo I. 2-1 I.. ( ~ [. 52- (. SlP [. <)''1 We will fit a model that includes interaction, also known as the full model. 7 / 29

Two-Way ANOVA: Parameter Estimates Our full-model fitted values: Ŷ ijk = ˆµ + ˆα i + ˆβ j + (αβ) ˆ ij Of course all observations in the same cell have the same fitted value. Our estimates for µ, α i, and β j are similar to what we saw in the additive two-factor CRD... ˆµ = Ȳ... Overall mean ˆα i = Ȳ i.. Ȳ... main effects of factor A level i ˆβ j = Ȳ.j. Ȳ... main effects of factor B level j To get our estimator for (αβ) ij, we should note that the full model (with interaction) allows for effects due to individual combinations of A and B. 8 / 29

Two-Way ANOVA: Full-Model Fitted Values The fitted values Ŷijk in the full model ARE the cell means (i.e. just the mean of all observations in the cell). Example (Animal Fattening example) The cell means for the animal fattening example give us the fitted values for the full model, or the two-way ANOVA with interaction: Ȳ 11. = Ŷ11k = 1.19 Ȳ 21. = Ŷ21k = 1.22 Ȳ 12. = Ŷ 12k = 1.03 Ȳ 11. = Ŷ 22k = 1.54 for k = 1, 2, 3 9 / 29

Two-Way ANOVA: Parameter Estimates The estimates for the interaction effects, or the (αβ) ˆ ij values, quantify how far the full-model fitted values are from the additive-model fitted values (or reduced model fitted values). Thus, we need the additive-model fitted values (we already know how to get these) and the full-model fitted values (just the cell means) to estimate the (αβ) ij values. Additive model fitted values: Ŷ ijk = ˆµ + ˆα i + ˆβ j Later, when we test for an interaction effect, relatively large ˆ (αβ) ij ˆ (αβ) ij values are all values suggest there is an interaction present. If very small, then no interaction is present, or the additive model is sufficient. 10 / 29

Two-Way ANOVA: Parameter Estimates Example (Animal Fattening example) Two primary factors: Vitamin B12 (0mg, 5mg) & Antibiotics (0mg, 40mg) What are the additive-model fitted values? Ŷ ijk = ˆµ + ˆα i + ˆβ j 11 / 29

Two-Way ANOVA: Parameter Estimates Example (Animal Fattening example) The additive model (reduced model) finds the best fit (smallest SSE) such that the interaction plot has parallel lines. l-d The estimate for each (αβ) ˆ ij can be found by subtracting the additive fit for cell ij from the full-model fit for that cell. 12 / 29

Two-Way ANOVA: Parameter Estimates Example (Animal Fattening example) The estimate for each (αβ) ˆ ij can be found by subtracting the additive fit for cell ij from the full model fit for that cell, or (αβ) ˆ ij =Ŷ ij,full Ŷ ij,additive S;m; l~ ) r-. qj(b t \.::: l, (<1 -- I. 0 "7-0, I L- A o(p'2-1 ~ I, 2 2. ~ (. 3 Y -==-- - O. /2- A crfo L 2- :::- i, ")1 -- I. C/2::: O. I L 13 / 29

o(p'2-1 ~ I, 2 2. ~ (. 3 Y -==-- - O. /2- Two-Way A ANOVA: Parameter Estimates crfo L 2- :::- i, ")1 -- I. C/2::: O. I L -- v.. - v y. --y. 111~ I' -. + cj I".. 'J «: ~Po 14 / 29

Two-Way ANOVA: Parameter Estimates -- v.. - v y. --y. 111~ I' -. + cj I".. 'J «: ~Po 15 / 29

Two-Way ANOVA: Parameter Estimates Example (Animal Fattening example) Use the parameter estimates to show that fitted is truly the same as the cell mean. Y es~ ~ ~. s~ a4lj t, 1';, k- -=- Y ~ CJl.fJ2 V>'U2a/Yl -3-1/ 3 -r - ~'~ ~/V~ S~/rt ~ ~ 6C2/~ JYz ~ (C S to?? - Iv -?::c r: 0 ~" r:ie»i-r- I C!;'on 5, 16 / 29

Two-Way ANOVA: Restrictions on Parameters The estimators we ve shown here are based on the sum-to-zero restrictions. The animal fattening experiment has 4 cell means, and only 4 parameters are needed to describe the mean structure (i.e. µ 1, µ 2, µ 3, µ 4 ) But the full effects model utilizes 9 parameters to describe the 4 means: µ, α 1, α 2, β 1, β 2, (αβ) 11, (αβ) 12, (αβ) 21, (αβ) 22 So, we utilize restrictions to make the parameters uniquely estimable (and interpretable). 17 / 29

Two-Way ANOVA: Restrictions on Parameters Sum-to-zero restrictions on parameters: a b a b 0 = α i = β j = (αβ) ij = (αβ) ij i=1 j=1 i=1 j=1 SAS uses a different constraint or restriction, and this affects the interpretation or the parameters (we will see this soon). The other parameter to be estimated is σ 2 in the full model: Lito O~ jjta/(~ :h k d~ co a: L c:., It, _ "Z.. D- 2-= fylse zz: '0[;;:. _:- z (Y~~ - Y:;L~) N -~~S ) N - (~~ ) Example (Animal Fattening example) For the full model with the animal fattening data, ˆσ 2 = SSE 12 4 = 0.029 8 = 0.0036 and ˆσ = 0.0602 18 / 29

Two-Way ANOVA: SS for Balanced Design 1~/1''')a.. I 2. h v,j k '" Ai + G-f -' ~. +fy# )'" + ~I~I~.., b A 2 i d ~ AN'OIJIt f~ J" IwD-~ tr.{) (6.f-tt ld. r 5J;t.Jf,Idr) I I T '/,I I t ;f~sj~/~ bj~ dh/~ Lu~'II~ e~ ~ ~~ d-f: 5S ;\II S E(MS) A - 8 b -I 19 / 29

Two-Way ANOVA: SS for Balanced Design Oehlert provides the table with slightly Factorial different Treatment notation, Structure using the effects notation: Term Sum of Squares Degrees of Freedom A B AB Error Total a bn( α i ) 2 a 1 i=1 b an( β j ) 2 b 1 j=1 a,b i=1,j=1 a,b,n i=1,j=1,k=1 a,b,n i=1,j=1,k=1 n( αβ ij ) 2 (a 1)(b 1) (y ijk y ij ) 2 ab(n 1) (y ijk y ) 2 abn 1 20 / 29

Two-Way ANOVA: SS for Balanced Design dels with Parameters Reminder of estimators, shown in Oehlert. µ = y α i = y i µ = y i y β j = y j µ = y j y αβ ij = y ij µ α i β j = y ij y i y j + y Display 8.2: Estimators for main effects and interactions in a two-way factorial. of them can vary freely; there are a 1 degrees of freedom for factor ilarly, the β j values must sum to 0, so at most b 1 of them can vary 21 / 29

Two-Way ANOVA: Two-Factor SAS Example Experiment Example (Animal Fattening example) +r6yjt ett( 1(' tryfi I( -h'{o/fu e Two Primary Factors: Vitamin B12 (Omgand 5 mg) and Antibioitic (Omg and 40 mg) Response: Weight gain in lbs/week Three animals are randomly assigned to each of the 4 treatments as a completely randomized design / (CRD). SAS Program Part 1: /*Fit the full model (with interaction)*/ proc glm data=anfat plot=diagnostics; class animal antibiotic vitamin; model gain=vitamin antibiotic vitamin*antibiotic; output out=diagnostics p=predicted r=residual; run; Ani, b,ot/l ~rn SAS Output from Part 1: The GLM Procedure Dependent Variable: gain Source Model Error Corrected R-Square 0.934046 Total Coeff Var 4.835982 Sumof DF / Squares 3 0.41070000 8 0.02900000 11 0.43970000 ~ Root MSE~ gain Mean 0.060208 1.245000 Mean Square F Value Pr > F 0.13690000 0.00362500 37.77 <.0001 (}1t~~ F--6.4l " ~I 22 / 29

0.934046 4.835982 0.060208 1.245000 Two-Way ANOVA: SAS Example Source DF Type I SS Mean Square F Value Pr > F vitamin 1 0.21870000 0.21870000 60.33 <.0001 antibiotic 1 0.01920000 0.01920000 5.30 0.0504 vitamin*antibiotic 1 0.17280000 0.17280000 47.67 0.0001 \~;:- DF Type III SS Mean Square F Value Pr > F \ vitamin 1 0.21870000 0.21870000 60.33 <.0001 antibiotic 1 0.01920000 0.01920000 5.30 0.0504, vit ami.n=arrtabf otlc 1 0.17280000 0.17280000 47.67 0.0001 Example (Animal Fattening example)! - -------- ~---~--- ~-~..-~----~- --- ANDVA kb/e 1 2 - -fug-lvr-s wiftt Wt Ie (tl-it5f1- We start by testing the highest-order interaction term, if that interaction is not significant, then we move to lower-order terms. Here, the interaction is significant (p=0.0001), so we will NOT consider the tests for main effects. The hierarchy principle says they must now remain in the model regardless of their significance. Remember to check all assumptions for the model using diagnostics. 23 / 29

Two-Way ANOVA: SAS Example Example (Animal Fattening example) See handout on PROC GLM, two-way ANOVA 24 / 29

Two-Way ANOVA: Overparameterization Y ijk = µ + α i + β j + (αβ) ij + ɛ ijk with ɛ ijk iid N(0, σ 2 ) Writing the factor effects model (a = 2, b = 2, n = 2) as a linear model Y = X β + ɛ µ 1 1 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 α 1 ɛ 111 1 1 0 0 1 0 1 0 0 α 2 ɛ 112 Y = 1 1 0 0 1 0 1 0 0 β 1 ɛ 121 1 0 1 1 0 0 0 1 0 β 2 + ɛ 122 1 0 1 1 0 0 0 1 0 (αβ) 11 ɛ 211 1 0 1 0 1 0 0 0 1 (αβ) 12 ɛ 212 (αβ) 1 0 1 0 1 0 0 0 1 21 ɛ 221 ɛ (αβ) 222 22 But the model is overparametrized and the X matrix is not of full rank. The OLS estimates could be found by using a generalized inversed: ˆβ = (X X ) XY, but we can also fix this by imposing restrictions on the parameters. 25 / 29

Two-Way ANOVA: Re-written X design matrix Using sum-to-zero restrictions and re-writing as a full rank design matrix: 1 1 1 1 ɛ 111 1 1 1 1 ɛ 112 1 1 1 1 µ ɛ 121 Y = 1 1 1 1 α 1 1 1 1 1 β 1 + ɛ 122 ɛ 211 1 1 1 1 (αβ) 11 ɛ 212 1 1 1 1 ɛ 221 1 1 1 1 ɛ 222 Other parameters determined by model restrictions: α 2 = α 1, β 2 = β 1, (αβ) 12 = (αβ) 21 = (αβ) 11, (αβ) 22 = (αβ) 21 26 / 29

Two-Way ANOVA: the Cell Means version of the model Though not commonly used, on occasion we may write the two-way ANOVA model using the cell means model notation: Y ijk = µ ij + ɛ ijk with ɛ ijk iid N(0, σ 2 ) where i = 1,..., a; j = 1,... b, k = 1..., n ij - µ ij is the mean of all units given level i of factor A and level j of factor B. - µ i. = - µ.j = - µ.. = j µ ij b is the mean response at level i of factor A. i µ ij a is the mean response at level j of factor B. i j µ ij ab is the overall mean response. 27 / 29

".. -,.",'" -,------ "--'''''-'--'''~'~''''-''-- -. Two-Way ANOVA: the Cell Means version of the model Example (Drill Speed and Feed Rate) ~f'u>1-u: rljuul ~ 7 4. divu /1.uY. A mechanical engineer is studying the thrust force developed by a drill press. Two primary factors are investigated; Drill Speed (125, 200) and Feed Rate (0.02, A IN.MM1I~ 0.03, 0.05, ~/~ 0.06). Two ;; runs J~fi7 will be performed Ik ~ at each combination performed in random order. JOLU- ~ 'c a- ~ I'/'~ F~rd Drii{s~ tun 6. ()'5. - o. o~ D. 0(, /2- C; z. 7-0 2. 'I') I 2. wo 1-2. "15 2. n I 2, f<j 2,?- z. I 2, '8"~ 1'-----, -+ "..,-_"..--,. 0.' I 200 2. g-~ I 2.3'') 2. "Z? 2.11'" _--- 2, Y/.p I 2, 70 2 -?7-2 ' 77 b.f. ij1ntl;~ {UJt>~} D~~ l<~~ IY{ I:~/~. W,'l d :04. rl/~ ~~: D.C. Montgomery (2005). Design and Analysis of Experiments. Wiley :USA 28 / 29

Two-Way ANOVA: the Cell Means version of the model Example (Drill Speed and Feed Rate) Thought of as cell means using cell means notation below: /2) e'lho q And the design matrix for X in the cell means model is again of full rank and no restrictions are needed for parameter estimation. 29 / 29