1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures
2 2-Factor Random Effects Model Assumptions: Sum-of-Squares obtained as in Fixed-Effects case
3 Expected Mean Squares for Random Effects 2-Factor ANOVA with Random Effects : A B AB Error Expected MS
4 To Test: we use F = MSA/MSAB we use F = MSB/MSAB we use F = MSAB/MSE Note: Test each of these 3 hypotheses (no matter whether H o : is rejected)
5 2-Factor Random Effects ANOVA Table Source SS df MS F Main Effects A SSA a 1 B SSB b 1 Interaction AB SSAB ( a 1)(b 1) Error SSE ab(n 1) Total TSS abn
6 Estimating Variance Components 2-Factor Random Effects Model (note error on page 986)
7
8 DATA one; INPUT operator filter loss; DATALINES; ; PROC GLM; CLASS operator filter; MODEL loss=operator filter operator*filter; TITLE ‘2-Factor Random Effects Model'; RANDOM operator filter operator*filter/test; RUN; Operator Filter Filtration Process: Response - % material lost through filtration A – Operator (randomly selected) ( a = ) B – Filter (randomly selected) ( b = ) n =
9 2-Factor Random Effects Model General Linear Models Procedure Dependent Variable: LOSS Sum of Mean Source DF Squares Square F Value Pr > F Model Error Corrected Total R-Square C.V. Root MSE LOSS Mean Source DF Type III SS Mean Square F Value Pr > F OPERATOR FILTER OPERATOR*FILTER Source Type III Expected Mean Square OPERATOR Var(Error) + 3 Var(OPERATOR*FILTER) + 9 Var(OPERATOR) FILTER Var(Error) + 3 Var(OPERATOR*FILTER) + 12 Var(FILTER) OPERATOR*FILTER Var(Error) + 3 Var(OPERATOR*FILTER) SAS Random-Effects Output (Filtration Data)
10 Tests of Hypotheses for Random Model Analysis of Variance Dependent Variable: LOSS Source: OPERATOR Error: MS(OPERATOR*FILTER) Denominator Denominator DF Type III MS DF MS F Value Pr > F Source: FILTER Error: MS(OPERATOR*FILTER) Denominator Denominator DF Type III MS DF MS F Value Pr > F Source: OPERATOR*FILTER Error: MS(Error) Denominator Denominator DF Type III MS DF MS F Value Pr > F SAS Random-Effects Output – continued “../test” option
11 Filtration Problem Results and Conclusions
12 Total Variability – 1-factor Model Based on the 1-factor random effects model, it follows that the total variability in Y can be expressed as As a result, an estimate of the proportion of variability explained by the random factor A can be estimated using
13 For the operator data example (1-factor random effects example from Thursday’s lecture) i.e. 78% of the variability in Y is explained by the operator to operator variability
14 Total Variability – 2 factor model For better appreciation of the role of the individual factors, it is helpful to express each variance as the proportion of total variability it explains. The proportion of variability explained by In 2-factor random effects model, we expressed the total variability in Y as Factor A = Factor B = Factor AB =
15 2-Factor Mixed Effects Model Assumptions: Sum-of-Squares obtained as before fixed random
16 Expected Mean Squares for Effects 2-Factor ANOVA with Mixed Effects : A B AB Error SAS Expected MS (fixed) (random) Book’s Expected MS
17 To Test: use F = SAS uses F = use F = Mixed-Effects Model Again: Test each of these 3 hypotheses as in random-effects case.
18 2-Factor Mixed-Effects ANOVA Table (using SAS Expected MS) Source SS df MS F Main Effects A SSA a 1 B SSB b 1 Interaction AB SSAB ( a 1)(b 1) Error SSE ab(n 1) Total TSS abn
19 Estimating Variance Components 2-Factor Mixed-Effects Model (based on SAS Expected MS) Note: A is a fixed effect
(F)ull Military Inspect. (R)educed Military Inspect. (C)ommercial Inspector Response – fatigue of mechanical part A – type of inspection ( a = ) B – inspector (randomly selected) (b = ) n = Product Inspection
21 DATA one; INPUT insp$ level$ fatigue; DATALINES; 1 F F F F C C C C C C 6.12 ; PROC GLM; CLASS insp level; MODEL fatigue= level insp level*insp; TITLE 'Mixed-Effects Model'; RANDOM insp level*insp/test; RUN; PROC MEANS mean var; CLASS level; VAR fatigue; RUN; Mixed-Effects Data
22 Mixed-Effects Model The GLM Procedure Dependent Variable: fatigue Sum of Source DF Squares Mean Square F Value Pr > F Model Error Corrected Total R-Square Coeff Var Root MSE fatigue Mean Source DF Type III SS Mean Square F Value Pr > F level insp insp*level SAS Mixed-Effects Output
23 Mixed-Effects Model The GLM Procedure Source Type III Expected Mean Square level Var(Error) + 5 Var(insp*level) + Q(level) insp Var(Error) + 5 Var(insp*level) + 15 Var(insp) insp*level Var(Error) + 5 Var(insp*level) Mixed-Effects Model The GLM Procedure Tests of Hypotheses for Mixed Model Analysis of Variance Dependent Variable: fatigue Source DF Type III SS Mean Square F Value Pr > F level insp Error Error: MS(insp*level) Source DF Type III SS Mean Square F Value Pr > F insp*level Error: MS(Error) SAS Mixed-Effects Output - Continued
24 Multiple Comparisons for Fixed Effect (Inspection Level) -- Use MSAB in place of MSE where ▪ N denotes the # of observations involved in the computation of a marginal mean ▪ v denotes the df associated with AB interaction
25 The MEANS Procedure Analysis Variable : fatigue N level Obs Mean Variance ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ C F R ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ SAS Mixed-Effects Output – Output from PROC Means
26 Mixed-Effects Example Results and Conclusions:
27 Repeated Measures Designs Setting: 1. Random sample of “subjects” 2. Each subject is measured at t different time points 3. Interested in the effect of treatment over time
28 Repeated Measures with a Single Factor Time Subject i th time period j th subject Reading for
29 Single Factor Repeated Measures Designs single factor repeated measures model is similar to the randomized complete block model - i.e. 2 factors (subject and time) with one observation cell - since there is only one observation per cell, we cannot estimate an interaction term typically: - subject is a random effect - time is a fixed effect timesubject
30 ANOVA Table for Repeated Measure Design with Single Factor Source SS df MS EMS F Between subjects SSP n 1 MSP MSP/MSE Time SSA a 1 MSA MSA/MSE Error SSE (n 1)(a 1) MSE Total TSS an
31 Data – 5 subjects take tablet -- blood samples taken.5, 1, 2, 3, and 4 hours after ingestion Goal: understand rate at which medicine enters blood Time Subject
32 Dependent Variable: conc Sum of Source DF Squares Mean Square F Value Pr > F Model <.0001 Error Corrected Total R-Square Coeff Var Root MSE conc Mean Source DF Type III SS Mean Square F Value Pr > F subject time <.000
33 The GLM Procedure t Tests (LSD) for conc NOTE: This test controls the Type I comparisonwise error rate, not the experimentwise error rate. Alpha 0.05 Error Degrees of Freedom 16 Error Mean Square Critical Value of t Least Significant Difference Means with the same letter are not significantly different. t Grouping Mean N time A B B B C D
34
35 Results:
36 Residual Diagnostics – 1-factor Repeated Measures Data
37 Two-Factor Repeated Measure Data (p.1033) Data – 10 subjects (5 take tablet, 5 take capsule) -- blood samples.5, 1, 2, 3, and 4 hours after ingestion Goal: compare blood concentration patterns of the two methods of administration Time Subject Time Subject TabletCapsule
38 2-Factor with Repeated Measure -- Model type subject within type time type by time interaction NOTE: type and time are both fixed effects in the current example
39 PROC GLM; CLASS type subject time; MODEL conc=type subject(type) time type*time; TITLE 'Repeated Measures – 2 factors'; OUTPUT out=new r=resid; MEANS type time/LSD; RANDOM subject(type)/test;
40 The GLM Procedure Dependent Variable: conc Sum of Source DF Squares Mean Square F Value Pr > F Model <.0001 Error Corrected Total R-Square Coeff Var Root MSE conc Mean Source DF Type III SS Mean Square F Value Pr > F type subject(type) <.0001 time <.0001 type*time < Factor Repeated Measures – ANOVA Output
41 2-factor Repeated Measures Source Type III Expected Mean Square type Var(Error) + 5 Var(subject(type)) + Q(type,type*time) subject(type) Var(Error) + 5 Var(subject(type)) time Var(Error) + Q(time,type*time) type*time Var(Error) + Q(type*time) The GLM Procedure Tests of Hypotheses for Mixed Model Analysis of Variance Dependent Variable: conc Source DF Type III SS Mean Square F Value Pr > F * type Error Error: MS(subject(type)) * This test assumes one or more other fixed effects are zero. Source DF Type III SS Mean Square F Value Pr > F subject(type) <.0001 * time <.0001 type*time <.0001 Error: MS(Error)
42 NOTE: Since time x type interaction is significant, and since these are fixed effects we DO NOT test main effects – we compare cell means (using MSE) C T Cell Means
43
44 Diagnostic Plots for 2-Factor Repeated Measures Data