Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures.

Similar presentations


Presentation on theme: "1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures."— Presentation transcript:

1 1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures

2 2 2-Factor Random Effects Model Assumptions: Sum-of-Squares obtained as in Fixed-Effects case

3 3 Expected Mean Squares for Random Effects 2-Factor ANOVA with Random Effects : A B AB Error Expected MS

4 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 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 6 Estimating Variance Components 2-Factor Random Effects Model (note error on page 986)

7 7

8 8 DATA one; INPUT operator filter loss; DATALINES; 1 1 16.2 1 1 16.8 1 1 17.1 1 2 16.6 1 2 16.9 1 2 16.8. 4 1 14.9 4 2 15.4 4 2 14.6 4 2 15.9 4 3 16.1 4 3 15.4 4 3 15.6 ; PROC GLM; CLASS operator filter; MODEL loss=operator filter operator*filter; TITLE ‘2-Factor Random Effects Model'; RANDOM operator filter operator*filter/test; RUN; 1 2 3 4 16.2 15.9 15.6 14.9 1 16.8 15.1 15.9 15.2 17.1 14.5 16.1 14.9 16.6 16.0 16.1 15.4 2 16.9 16.3 16.0 14.6 16.8 16.5 17.2 15.9 16.7 16.5 16.4 16.1 3 16.9 16.9 17.4 15.4 17.1 16.8 16.9 15.6 Operator Filter Filtration Process: Response - % material lost through filtration A – Operator (randomly selected) ( a = ) B – Filter (randomly selected) ( b = ) n =

9 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 11 16.60888889 1.50989899 8.16 0.0001 Error 24 4.44000000 0.18500000 Corrected Total 35 21.04888889 R-Square C.V. Root MSE LOSS Mean 0.789062 2.664175 0.4301163 16.144444 Source DF Type III SS Mean Square F Value Pr > F OPERATOR 3 10.31777778 3.43925926 18.59 0.0001 FILTER 2 4.63388889 2.31694444 12.52 0.0002 OPERATOR*FILTER 6 1.65722222 0.27620370 1.49 0.2229 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 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 3 3.4392592593 6 0.2762037037 12.4519 0.0055 Source: FILTER Error: MS(OPERATOR*FILTER) Denominator Denominator DF Type III MS DF MS F Value Pr > F 2 2.3169444444 6 0.2762037037 8.3885 0.0183 Source: OPERATOR*FILTER Error: MS(Error) Denominator Denominator DF Type III MS DF MS F Value Pr > F 6 0.2762037037 24 0.185 1.4930 0.2229 SAS Random-Effects Output – continued “../test” option

11 11 Filtration Problem Results and Conclusions

12 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 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 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 15 2-Factor Mixed Effects Model Assumptions: Sum-of-Squares obtained as before fixed random

16 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 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 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 19 Estimating Variance Components 2-Factor Mixed-Effects Model (based on SAS Expected MS) Note: A is a fixed effect

20 20 7.50 7.08 6.15 7.42 6.17 5.52 1 5.85 5.65 5.48 5.89 5.30 5.48 5.35 5.02 5.98 7.58 7.68 6.17 6.52 5.86 6.20 2 6.54 5.28 5.44 5.64 5.38 5.75 5.12 4.87 5.68 7.70 7.19 6.21 6.82 6.19 5.66 3 6.42 5.85 5.36 5.39 5.35 5.90 5.35 5.01 6.12 (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 21 DATA one; INPUT insp$ level$ fatigue; DATALINES; 1 F 7.50 1 F 7.42 1 F 5.85 1 F 5.89. 2 C 5.68 3 C 6.21 3 C 5.66 3 C 5.36 3 C 5.90 3 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 22 Mixed-Effects Model The GLM Procedure Dependent Variable: fatigue Sum of Source DF Squares Mean Square F Value Pr > F Model 8 2.70711111 0.33838889 0.53 0.8282 Error 36 23.11448000 0.64206889 Corrected Total 44 25.82159111 R-Square Coeff Var Root MSE fatigue Mean 0.104839 13.35141 0.801292 6.001556 Source DF Type III SS Mean Square F Value Pr > F level 2 2.58739111 1.29369556 2.01 0.1481 insp 2 0.02523111 0.01261556 0.02 0.9806 insp*level 4 0.09448889 0.02362222 0.04 0.9973 SAS Mixed-Effects Output

23 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 2 2.587391 1.293696 54.77 0.0012 insp 2 0.025231 0.012616 0.53 0.6229 Error 4 0.094489 0.023622 Error: MS(insp*level) Source DF Type III SS Mean Square F Value Pr > F insp*level 4 0.094489 0.023622 0.04 0.9973 Error: MS(Error) 36 23.114480 0.642069 SAS Mixed-Effects Output - Continued

24 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 25 The MEANS Procedure Analysis Variable : fatigue N level Obs Mean Variance ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ C 15 5.8066667 0.0981810 F 15 6.3393333 0.8208638 R 15 5.8586667 0.7405410 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ SAS Mixed-Effects Output – Output from PROC Means

26 26 Mixed-Effects Example Results and Conclusions:

27 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 28 Repeated Measures with a Single Factor Time Subject i th time period j th subject Reading for

29 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 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 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.5 1 2 3 4 1 50 75 120 60 30 2 40 80 135 70 40 3 55 75 125 85 50 4 70 85 140 90 40 5 60 90 150 95 50

32 32 Dependent Variable: conc Sum of Source DF Squares Mean Square F Value Pr > F Model 8 26442.00000 3305.25000 66.60 <.0001 Error 16 794.00000 49.62500 Corrected Total 24 27236.00000 R-Square Coeff Var Root MSE conc Mean 0.970847 8.985333 7.044501 78.40000 Source DF Type III SS Mean Square F Value Pr > F subject 4 1576.00000 394.00000 7.94 0.0010 time 4 24866.00000 6216.50000 125.27 <.000

33 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 49.625 Critical Value of t 2.11991 Least Significant Difference 9.4449 Means with the same letter are not significantly different. t Grouping Mean N time A 134.000 5 2 B 81.000 5 1 B B 80.000 5 3 C 55.000 5 0.5 D 42.000 5 4

34 34

35 35 Results:

36 36 Residual Diagnostics – 1-factor Repeated Measures Data

37 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.5 1 2 3 4 1 50 75 120 60 30 2 40 80 135 70 40 3 55 75 125 85 50 4 70 85 140 90 40 5 60 90 150 95 50 Time Subject.5 1 2 3 4 1 30 55 80 130 65 2 25 50 75 125 60 3 35 65 85 140 85 4 45 70 90 145 80 5 50 75 95 160 90 TabletCapsule

38 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 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 40 The GLM Procedure Dependent Variable: conc Sum of Source DF Squares Mean Square F Value Pr > F Model 17 57720.50000 3395.32353 110.87 <.0001 Error 32 980.00000 30.62500 Corrected Total 49 58700.50000 R-Square Coeff Var Root MSE conc Mean 0.983305 6.978545 5.533986 79.30000 Source DF Type III SS Mean Square F Value Pr > F type 1 40.50000 40.50000 1.32 0.2587 subject(type) 8 3920.00000 490.00000 16.00 <.0001 time 4 34288.00000 8572.00000 279.90 <.0001 type*time 4 19472.00000 4868.00000 158.96 <.0001 2-Factor Repeated Measures – ANOVA Output

41 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 1 40.500000 40.500000 0.08 0.7810 Error 8 3920.000000 490.000000 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) 8 3920.000000 490.000000 16.00 <.0001 * time 4 34288 8572.000000 279.90 <.0001 type*time 4 19472 4868.000000 158.96 <.0001 Error: MS(Error) 32 980.000000 30.625000

42 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).5 1 2 3 4 C 37 63 85 140 76 T 55 81 134 80 42 Cell Means

43 43

44 44 Diagnostic Plots for 2-Factor Repeated Measures Data


Download ppt "1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures."

Similar presentations


Ads by Google