Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Experimental Statistics - week 9 Chapter 17: Models with Random Effects Chapter 18: Repeated Measures.

Similar presentations


Presentation on theme: "1 Experimental Statistics - week 9 Chapter 17: Models with Random Effects Chapter 18: Repeated Measures."— Presentation transcript:

1 1 Experimental Statistics - week 9 Chapter 17: Models with Random Effects Chapter 18: Repeated Measures

2 2 Discussion of Comments upset about HW grade –I will drop one HW availability of slides HW - do by hand in-class examples

3 3

4 4 2-Factor Mixed Effects Model Assumptions: Sum-of-Squares obtained as before fixed random

5 5 Expected Mean Squares for Effects 2-Factor ANOVA with Mixed Effects : A B AB Error SAS Expected MS (fixed) (random) Book’s Expected MS

6 6 To Test: use F = SAS uses F = use F = Mixed-Effects Model Again: Test each of these 3 hypotheses as in random-effects case.

7 7 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 

8 8 Estimating Variance Components 2-Factor Mixed-Effects Model (based on SAS Expected MS) Note: A is a fixed effect

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

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

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

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

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

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

15 15 Mixed-Effects Example Results and Conclusions:

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

17 17 Repeated Measures with a Single Factor Time Subject i th time period j th subject Reading for

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

19 19 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 

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

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

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

23 23

24 24 Results:

25 25 Residual Diagnostics – 1-factor Repeated Measures Data

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

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

28 28 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;

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

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

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

32 32

33 33 Diagnostic Plots for 2-Factor Repeated Measures Data


Download ppt "1 Experimental Statistics - week 9 Chapter 17: Models with Random Effects Chapter 18: Repeated Measures."

Similar presentations


Ads by Google