MAT3378 ANOVA Summary

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

Factorial ANOVA. Psychology 3256

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

Two or more categorical predictors. 2.1 Two fixed effects

Analysis of Variance and Design of Experiments-I

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

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

Outline Topic 21 - Two Factor ANOVA

STAT Final Practice Problems

STAT 705 Chapter 19: Two-way ANOVA

STAT 705 Chapter 19: Two-way ANOVA

Statistics 512: Applied Linear Models. Topic 9

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

Chapter 11 - Lecture 1 Single Factor ANOVA

Topic 32: Two-Way Mixed Effects Model

Two-Way Analysis of Variance - no interaction

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

Two-Factor Full Factorial Design with Replications

3. Design Experiments and Variance Analysis

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

Nested Designs & Random Effects

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

Homework 3 - Solution

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

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

Fractional Factorial Designs

Statistics 512: Applied Linear Models. Topic 7

Factorial and Unbalanced Analysis of Variance

STAT 705 Chapter 16: One-way ANOVA

Chapter 8: Hypothesis Testing Lecture 9: Likelihood ratio tests

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

G. Nested Designs. 1 Introduction. 2 Two-Way Nested Designs (Balanced Cases) 1.1 Definition (Nested Factors) 1.2 Notation. 1.3 Example. 2.

BIOSTATISTICAL METHODS

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

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

CS 147: Computer Systems Performance Analysis

Nested 2-Way ANOVA as Linear Models - Unbalanced Example

CHAPTER 4 Analysis of Variance. One-way ANOVA Two-way ANOVA i) Two way ANOVA without replication ii) Two way ANOVA with replication

Lecture 10: Factorial Designs with Random Factors

Factorial designs. Experiments

Statistics For Economics & Business

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

Chapter 15: Analysis of Variance

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

ANOVA Randomized Block Design

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

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

Random and Mixed Effects Models - Part III

Research Methods II MICHAEL BERNSTEIN CS 376

Stat 511 HW#10 Spring 2003 (corrected)

Analysis of Variance

Graduate Lectures and Problems in Quality Control and Engineering Statistics: Theory and Methods

16.3 One-Way ANOVA: The Procedure

Two Factor Full Factorial Design with Replications

Chapter 11 - Lecture 1 Single Factor ANOVA

2017 Financial Mathematics Orientation - Statistics

Lecture 22 Mixed Effects Models III Nested designs

Chapter 6 Randomized Block Design Two Factor ANOVA Interaction in 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) =

Multiple Comparisons. The Interaction Effects of more than two factors in an analysis of variance experiment. Submitted by: Anna Pashley

AN IMPROVEMENT TO THE ALIGNED RANK STATISTIC

Much of the material we will be covering for a while has to do with designing an experimental study that concerns some phenomenon of interest.

Formal Statement of Simple Linear Regression Model

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

WITHIN-PARTICIPANT EXPERIMENTAL DESIGNS

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

One-Way Analysis of Variance. With regression, we related two quantitative, typically continuous variables.

The Dependence of Repair Times of Safety-significant Devices on Repair Class in the Loviisa Nuclear Power Plant

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

Orthogonal contrasts for a 2x2 factorial design Example p130

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

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

Factorial Designs. Prof. Daniel A. Menasce Dept. of fcomputer Science George Mason University. studied simultaneously.

1 Introduction to One-way ANOVA

V. Experiments With Two Crossed Treatment Factors

STAT 401A - Statistical Methods for Research Workers

4.1. Introduction: Comparing Means

Power & Sample Size Calculation

Chapter 10: Analysis of variance (ANOVA)

Statistical Analysis of Unreplicated Factorial Designs Using Contrasts

Two-Way Factorial Designs

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

df=degrees of freedom = n - 1

1 The Randomized Block Design

Multiple Sample Numerical Data

Grant MacEwan University STAT 252 Dr. Karen Buro Formula Sheet

Unit 8: A Mixed Two-Factor Design

Chapter 11: Factorial Designs

Model II (or random effects) one-way ANOVA:

Lec 5: Factorial Experiment

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

EX1. One way ANOVA: miles versus Plug. a) What are the hypotheses to be tested? b) What are df 1 and df 2? Verify by hand. , y 3

Chapter 4: Randomized Blocks and Latin Squares

2 k, 2 k r and 2 k-p Factorial Designs

STAT22200 Spring 2014 Chapter 8A

Lektion 6. Measurement system! Measurement systems analysis _3 Chapter 7. Statistical process control requires measurement of good quality!

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

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

Design & Analysis of Experiments 7E 2009 Montgomery

Transcription:

MAT3378 ANOVA Summary April 18, 2016 Before you do the analysis: How many factors? (one-factor/one-way ANOVA, two-factor ANOVA etc.) Fixed or Random or Mixed effects? Crossed-factors; nested factors or partially nested factors? The same or different sample sizes for each treatment? Contents 1 One Factor Anova 2 1.1 Fixed effects................................ 2 1.2 Random effects.............................. 5 2 Two-Factor ANOVA with crossed-factors 8 2.1 Fixed effects - equal sample sizes for each treatment......... 8 2.2 Random effects - equal sample sizes for each treatment....... 13 2.3 Mixed effects - equal sample sizes for each treatment (Chapter 25.2) 15 3 Two-Factor ANOVA with nested design 17 3.1 Fixed effects................................ 17 3.2 Random effects.............................. 20 3.3 Mixed effects............................... 20 4 Complicated designs: Three-Factor ANOVA with partially nested design and mixed effects 21 4.1 Fixed-effects only............................. 21 4.2 Mixed-effects............................... 23 1

1 One Factor Anova 1.1 Fixed effects Textbook: Chapter 16; p. 681 Model: Estimates: µ is a constant, Y ij = µ i + ε ij = µ + α i + ε ij, µ i are factor level means (fixed, deterministic), α i are factor level effects, α i = µ i µ, ε ij are indepndent N(0, σ 2 ), i = 1,..., r, r is the number of factor levels, j = 1,..., n i, n i is the sample size for the level i, N = n 1 + + n r. Y i = Y = ni, i = 1,..., r, sample mean for level i. n i ni, i = 1,..., r, overall mean. N r Sums of Squares: Decomposition Y ij Y = Y ij Y i + Y i Y }{{ } Total deviation Deviation of each observation from the factor level mean Deviation of the factor level mean from the overall mean leads to SSTO = SSE + SSTR, 2

SSTO = SSTR = SSE = r n i ( 2 Yij Y ) r ( 2 n i Y i Y ) n i r ( 2 Yij Y i ) Degrees of freedom: SSTO has n 1 degrees of freedom, since there are n observations and one constrain: r ni (Y ij Y ) = 0; SSTR has r 1 degrees of freedom, since there are r levels and one constrain: r n i(y i Y ) = 0; The number of degrees of freedom is n r since we must have N 1 = (N r) + (r 1). Mean Squares: Sums of squares and the number of degrees of freedom lead to: Expected Values: MSTR = SSTR r 1, MSE = SSE N r E[MSE] = σ 2, (1) r E[MSTR] = σ 2 + n i(µ i µ ) r 1 µ is a weighted mean: µ = r n iµ i /N. Test: H 0 : µ 1 = = µ r. If all factor level means are the same, then E[MSTR] = σ 2. Hence, the test statistics for H 0 can be constructed by comparing MSTR with MSE. ANOVA table: 3

source df SS MS F Treatment r 1 SSTR MSTR F Error (Residuals) N r SSE MSE Total N 1 SSTO F = MSTR MSE has F distribution with (r 1, N r) degrees of freedom. Estimation: Goal: estimate µ i ; Estimator: Y i ; σ 2 [Y i ] = σ 2 /N; By 1, σ 2 can be estimated by MSE which has N r degrees of freedom; The confidence interval for µ i is R implementation: aov(y~x) Y i ± t(1 α/2, N r) MSE 1 n i. 4

1.2 Random effects Textbook: Chapter 25.1; p. 1031 Model: Y ij = µ i + ε ij, µ i are independent N(µ, σµ) 2, ε ij are independent N(0, σ 2 ), µ i and ε ij are independent, i = 1,..., r, r is the number of factor levels, j = 1,..., n i, n is the sample size for the level i, N = nr. Estimates: Y i = Y = ni, i = 1,..., r, sample mean for level i. n i ni, i = 1,..., r, overall mean. N r Sums of Squares: Decomposition Y ij Y = Y ij Y i + Y i Y }{{ } Total deviation Deviation of each observation from the factor level mean Deviation of the factor level mean from the overall mean leads to SSTO = SSE + SSTR, 5

SSTO = SSTR = SSE = r n i ( 2 Yij Y ) r ( 2 n i Y i Y ) n i r ( 2 Yij Y i ) Degrees of freedom: SSTO has N 1 degrees of freedom, since there are n observations and one constrain: r ni (Y ij Y ) = 0; SSTR has r 1 degrees of freedom, since there are r levels and one constrain: r n i(y i Y ) = 0; The number of degrees of freedom is N r since we must have N 1 = (N r) + (r 1). Mean Squares: Sums of squares and the number of degrees of freedom lead to: Expected Values: MSTR = SSTR r 1, MSE = SSE N r E[MSE] = σ 2, (2) E[MSTR] = σ 2 + nσ 2 µ. (3) Note the difference in E[MSTR] as compared to the fixed effects ANOVA. Test: ANOVA table: H 0 : σ µ = 0. 6

source df SS MS F Treatment r 1 SSTR MSTR F Error (Residuals) N r SSE MSE Total N 1 SSTO F = MSTR MSE has F distribution with (r 1, N r) degrees of freedom. Estimation I: Goal: estimate µ ; Estimator: Y ; σ 2 [Y ] = nσ2 µ +σ2 rn ; By 3, the right hand-side can be estimated by MSTR nr of freedom; which has r 1 degrees The confidence interval for µ is Y ± t(1 α/2, r 1) 1 MSTR rn. Note the difference in as compared to the fixed effects ANOVA. Estimation II: Goal: estimate R implementation: aov(y~x) σ 2 µ σ 2 µ +σ2, σ 2, σ 2 µ; 7

2 Two-Factor ANOVA with crossed-factors 2.1 Fixed effects - equal sample sizes for each treatment Textbook: Chapter 19; p. 812 Model: µ is a constant, Y ijk = µ + α i + β j + (αβ) ij + ε ijk, α i are main effects for Factor A, β i are main effects for Factor B, a α i = 0, b β j = 0, (αβ) ij are interactions between A, B, a (αβ) ij = 0, j = 1,..., b b (αβ) ij = 0, i = 1,..., a ε ijk are independent N(0, σ 2 ), i = 1,..., a, a is the number of factor levels for A, j = 1,..., b, b is the number of factor levels for B, k = 1,..., n, n is the sample size for the level treatment (i, j), N = nab, the total sample size. Estimates: n k=1 Y ij = Y ijk, i = 1,..., a, j = 1,..., b, sample mean for treatment (i, j), n b n k=1 Y i = Y ijk, i = 1,..., a, sample mean for level i of factor A, bn a n k=1 Y j = Y ijk, j = 1,..., b, sample mean for level j of factor B. an Y = a b n k=1 N, i = 1,..., r, overall mean. 8

Sums of Squares: Decomposition Y ijk Y = Y ijk Y ij + Y ij Y Total deviation Deviation of each observation from the treatment mean Deviation of the treatment mean from the overall mean leads to SSTO = SSE + SSTR, a b n ( 2 SSTO = Yijk Y ) k=1 a b ( 2 SSTR = n Y ij Y ) a b n ( 2 SSE = Yijk Y ij ). k=1 Further decomposition Y ij Y Deviation of the treatment mean from the overall mean leads to = Y i Y }{{ } + Y j Y Factor A main effect Factor B main effect SSTR = SSA + SSB + SSAB, + Y ij Y i Y j + Y Interaction a ( 2 SSA = nb Yi Y ) SSB = na b ( 2 Y j Y ) a b ( 2 SSAB = n Yij Y i Y j + Y ). Degrees of freedom: 9

SSTO has N 1 degrees of freedom, since there are N observations and one constrain; SSTR has ab 1 degrees of freedom, since there are ab treatments and one constrain: SSE: The number of degrees of freedom is N ab since we must have N 1 = (N ab) + (ab 1). SSA has a 1 degrees of freedom since there are a levels and 1 constrain; SSB has b 1 degrees of freedom since there are b levels and 1 constrain; SSAB has (a 1)(b 1) degrees of freedom since we must have ab 1 = (a 1) + (b 1) + (ab 1), Mean Squares: Sums of squares and the number of degrees of freedom lead to: MSTR = SSTR ab 1, MSE = SSE N ab, MSA = SSA a 1, MSB = SSB b 1, MSAB = SSAB (a 1)(b 1), Expected Values: E[MSE] = σ 2, (4) a E[MSA] = σ 2 + nb (µ i µ ) 2 a = σ 2 + nb α2 i, (5) a 1 a 1 b E[MSB] = σ 2 + na (µ j µ ) 2 b = σ 2 + na β2 j, (6) b 1 b 1 E[MSAB] = σ 2 + n a b (αβ) ij (a 1)(b 1), (7) 10

Tests: H 0 : α 1 = = α a = 0 (equivalently) H 0 : µ 1 = = µ a. H 0 : β 1 = = β b = 0 (equivalently) H 0 : µ 1 = = µ b, H 0 : (αβ) ij = 0. Equations (4)-(7) suggest evaluation of MSA/MSE; MSB/MSE; MSAB/MSE. ANOVA table: source df SS MS F Factor A a 1 SSA MSA F A Factor B b 1 SSB MSB F B Interactions AB (a 1)(b 1) SSAB MSAB F AB Error (Residuals) N ab SSE MSE Total N 1 SSTO F A = MSA MSE, F B = MSB MSE, F AB = MSAB MSE, have F distribution with (a 1, N ab), (b 1, N ab) and ((a 1)(b 1), N ab) degrees of freedom, respectively. Estimation: Goal: estimate L = a c iµ i ; Estimator: ˆL = a c iy i ; σ 2 [ˆL] = σ2 bn a c2 i ; We estimate σ 2 by MSE which has N ab degrees of freedom; The confidence interval for L is ˆL ± t(1 α/2, N ab) 1 MSE bn. R implementation: 11

aov(y~xa*xb) aov(y~xa+xb+xa*xb) aov(y~xa+xb+xa:xb) Note: aov(y~xa+xb) produces the output for the model aov(y~xa:xb) produces the output for the model Y ijk = µ + α i + β j + ε ijk, Y ijk = µ + (αβ) ij + ε ijk, 12

2.2 Random effects - equal sample sizes for each treatment Textbook: Chapter 25.2; p. 1047 Model: µ is a constant, Y ijk = µ + α i + β j + (αβ) ij + ε ijk, α i, β j, (αβ) ij, are independent zero-mean normal random variables with variances σ 2 α, σ 2 β, σ2 αβ, ε ij are independent N(0, σ 2 ), α i, β j, (αβ) ij and ε ijk are independent, i = 1,..., a, j = 1,..., b, k = 1,..., n, N = nab, the total sample size. Expected Values: Instead of (4)-(7), we have Tests: E[MSE] = σ 2, (8) E[MSA] = σ 2 + nbσ 2 α + nσ 2 αβ, (9) E[MSB] = σ 2 + naσ 2 β + nσ2 αβ, (10) E[MSAB] = σ 2 + nσ 2 αβ, (11) H 0 : σ α = 0, H 0 : σ β = 0, H 0 : σ αβ = 0. Equations (8)-(11) suggest evaluation of MSA/MSAB; MSB/MSAB; MSAB/MSE. ANOVA table: source df SS MS F Factor A a 1 SSA MSA F A Factor B b 1 SSB MSB F B Interactions AB (a 1)(b 1) SSAB MSAB F AB Error (Residuals) N ab SSE MSE Total N 1 SSTO 13

F A = MSA MSAB, F B = MSB MSAB, F AB = MSAB MSE, have F distribution with (a 1, (a 1)(b 1)), (b 1, (a 1)(b 1)) and ((a 1)(b 1), N ab) degrees of freedom, respectively. R implementation: Use the fixed-effects commands: aov(y~xa*xb) aov(y~xa+xb+xa*xb) aov(y~xa+xb+xa:xb) Ignore F statistics and p-values and compute them on your own. 14

2.3 Mixed effects - equal sample sizes for each treatment (Chapter 25.2) Textbook: Chapter 25.2; p. 1047 Model: µ is a constant, α i are fixed Factor A main effects, Y ijk = µ + α i + β j + (αβ) ij + ε ijk, a α i = 0, β j, (αβ) ij, are independent zero-mean normal random variables with variances σ 2 β, (a 1)σ2 αβ /a, ε ijk are independent N(0, σ 2 ), β j, (αβ) ij and ε ijk are independent, i = 1,..., a, j = 1,..., b, k = 1,..., n, N = nab, the total sample size. Expected Values: Instead of (8)-(11), we have Tests: E[MSE] = σ 2, (12) a α2 i E[MSA] = σ 2 + nb + nσαβ 2 a 1, (13) E[MSB] = σ 2 + naσβ 2, (14) E[MSAB] = σ 2 + nσ 2 αβ, (15) H 0 : α 1 = = α a = 0, H 0 : σ β = 0, H 0 : σ αβ = 0. Equations (8)-(11) suggest evaluation of MSA/MSAB; MSB/MSE; MSAB/MSE. ANOVA table: 15

source df SS MS F Factor A a 1 SSA MSA F A Factor B b 1 SSB MSB F B Interactions AB (a 1)(b 1) SSAB MSAB F AB Error (Residuals) N ab SSE MSE Total N 1 SSTO F A = MSA MSAB, F B = MSB MSE, F AB = MSAB MSE, have F distribution with (a 1, (a 1)(b 1)), (b 1, N ab) and ((a 1)(b 1), N ab) degrees of freedom, respectively. R implementation: Use the fixed-effects commands: aov(y~xa*xb) aov(y~xa+xb+xa*xb) aov(y~xa+xb+xa:xb) Ignore F statistics and p-values and compute them on your own. 16

3 Two-Factor ANOVA with nested design 3.1 Fixed effects Textbook: Chapter 26.1; p. 1089. For random and mixed effects see Table 26.5 on page 1099. Model: µ is a constant, α i are fixed Factor A main effects, β j(i) are within levels effects, ε ijk are independent N(0, σ 2 ), i = 1,..., a, Y ijk = µ + α i + β j(i) + ε ijk, a α i = 0, b β j(i) = 0, j = 1,..., b, b is the number of levels of Factor B within each level of Factor A; k = 1,..., n, N = nab, the total sample size. Sums of Squares: Decomposition Y ijk Y = Y ijk Y ij + Y ij Y Total deviation Deviation of each observation from the treatment mean Deviation of the treatment mean from the overall mean leads to SSTO = SSE + SSTR, 17

a b n ( 2 SSTO = Yijk Y ) k=1 a b ( 2 SSTR = n Y ij Y ) a b n ( 2 SSE = Yijk Y ij ). k=1 Further decomposition Y ij Y Deviation of the treatment mean from the overall mean leads to SSTR = SSA + SSB(A), = Y i Y }{{ } + Y ij Y i Factor A main effect Factor B effects within A a ( 2 SSA = nb Yi Y ) a SSB(A) = n b ( 2 Y ij Y i ). Degrees of freedom: SSTO has N 1 degrees of freedom, since there are N observations and one constrain; SSTR has ab 1 degrees of freedom, since there are ab treatments and one constrain: SSE: The number of degrees of freedom is N ab since we must have N 1 = (N ab) + (ab 1). SSA has a 1 degrees of freedom since there are a levels and 1 constrain; SSB(A) has a(b 1) degrees of freedom since for each level of A we have b levels less 1 constrain; 18

Mean Squares: Sums of squares and the number of degrees of freedom lead to: MSTR = SSTR ab 1, MSE = SSE N ab, MSA = SSA a 1, MSB = SSB b 1, MSB(A) = SSB(A) a(b 1). Expected Values: E[MSE] = σ 2, (16) E[MSA] = σ 2 + nb a α2 i a 1, (17) Tests: E[MSB(A)] = σ 2 + n a b β2 j(i) a(b 1) H 0 : α 1 = = α a = 0, H 0 : β j(i) = 0,, (18) Equations (16)-(18) suggest evaluation of MSA/MSE; MSB(A)/MSE. ANOVA table: source df SS MS F Factor A a 1 SSA MSA Factor B within A a(b 1) SSB MSB FA FB(A) Error (Residuals) N ab SSE MSE Total N 1 SSTO F A = MSA MSE, F B(A) = MSB(A) MSE, 19

have F distribution with (a 1, N ab), (a(b 1), N ab) degrees of freedom, respectively. R implementation: aov(y~xa+xa/xb) For random and mixed effects ignore the F and p-value part and calculate manually. 3.2 Random effects Expected Values: E[MSE] = σ 2, (19) E[MSA] = σ 2 + nbσα 2 + nσβ 2, (20) E[MSB(A)] = σ 2 + nσβ 2, (21) 3.3 Mixed effects Model: Y ijk = µ + α i + β j(i) + ε ijk, µ is a constant, α i are fixed Factor A main effects, β j(i) are N(0, σβ 2 ), ε ijk are independent N(0, σ 2 ), ε ijk, β j(i) are independent, a α i = 0, j = 1,..., b, b is the number of levels of Factor B within each level of Factor A; k = 1,..., n, N = nab, the total sample size. Expected Values: 20

A - fixed; B - random E[MSE] = σ 2, (22) a α2 i E[MSA] = σ 2 + nb + nσβ 2 a 1, (23) E[MSB(A)] = σ 2 + nσβ 2, (24) 4 Complicated designs: Three-Factor ANOVA with partially nested design and mixed effects Textbook: Chapter 26.9; p. 1114 4.1 Fixed-effects only Model: Set-up: All effects are fixed, A and B interact, C nested in A. Y ijkm = µ + α i + β j + (αβ) ij + γ k(i) + (βγ) jk(i) + ε ijkm, 21

µ is a constant, α i are fixed Factor A main effects, β j are fixed Factor B main effects, (αβ) ij are interactions between A, B, a (αβ) ij = 0, j = 1,..., b b (αβ) ij = 0, i = 1,..., a γ k(i) are C within A effects, a α i = 0, b β j = 0, c γ k(i) = 0, (βγ) jk(i) are B and C interactions within A, ε ijkm are independent N(0, σ 2 ), i = 1,..., a, j = 1,..., b, k = 1,..., c, m = 1,..., n, N = nabc, the total sample size. c (βγ) jk(i) = 0, Tests: H 0 : α 1 = = α a = 0. ANOVA table: 22

source df SS MS F Factor A a 1 SSA MSA FA Factor B b 1 SSB MSB FB Interactions A and B (a 1)(b 1) SSAB MSAB FAB C nested in A a(c-1) SSC(A) MSC(A) FC(A) Interactions B and C nested in A a(b 1)(c 1) SSBC(A) MSBC(A) FBC(A) Error (Residuals) N ab SSE MSE Total N 1 SSTO F A = MSA MSE, F B = MSB MSE, F AB = MSAB MSE, F C(A) = MSC(A) MSE, F BC(A) = MSBC(A), MSE have F distribution with (a 1, N ab), (b 1, N ab), ((a 1)(b 1), N ab), (a(c 1), N ab), (a(b 1)(c 1), N ab) degrees of freedom, respectively. 4.2 Mixed-effects Model: Set-up: A and B are fixed, C is random; A and B interact, C nested in A. Y ijkm = µ + α i + β j + (αβ) ij + γ k(i) + (βγ) jk(i) + ε ijkm, 23

µ is a constant, α i are fixed Factor A main effects, β j are fixed Factor B main effects, (αβ) ij are interactions between A, B, a (αβ) ij = 0, j = 1,..., b b (αβ) ij = 0, i = 1,..., a a α i = 0, b β j = 0, γ k(i) are random C within A effects, N(0, σγ) 2, (βγ) jk(i) are random B and C interactions within A, N(0, σβγ 2 ), ε ijkm are independent N(0, σ 2 ), all random variables are considered to be normal and independent, i = 1,..., a, j = 1,..., b, k = 1,..., c, m = 1,..., n, N = nabc, the total sample size. Expected Values: E[MSE] = σ 2, (25) E[MSA] = σ 2 + nbc a α2 i a 1 + bnσ 2 γ, (26) b β2 j E[MSB] = σ 2 + nac + nσβγ 2 b 1, (27) E[MSC(A)] = σ 2 + bnσγ 2, (28) a b E[MSAB] = σ 2 + cn (αβ) ij + nbσβγ 2 (a 1)(b 1), (29) E[MSBC(A)] = σ 2 + nσ 2 βγ, (30) 24

Tests: H 0 : α 1 = = α a = 0, ANOVA table: source df SS MS F Factor A a 1 SSA MSA FA Factor B b 1 SSB MSB FB Interactions A and B (a 1)(b 1) SSAB MSAB FAB C nested in A a(c-1) SSC(A) MSC(A) Interactions B and C nested in A a(b 1)(c 1) SSBC(A) MSBC(A) Error (Residuals) N ab SSE MSE Total N 1 SSTO F A = MSA MSC(A), F B = MSB MSBC(A), F AB = MSAB MSBC(A), have F distribution with (a 1, a(c 1)), (b 1, a(b 1)(c 1)), ((a 1)(b 1), a(b 1)(c 1)) degrees of freedom, respectively. R implementation: aov(y~xa+xb+xa:xb+xa/xc+xa/(xb:xc)) For random and mixed effects ignore the F and p-value part and calculate manually. 25