Download presentation

Presentation is loading. Please wait.

Published byKaila Spinks Modified over 2 years ago

1
Topic 32: Two-Way Mixed Effects Model

2
Outline Two-way mixed models Three-way mixed models

3
Data for two-way design Y is the response variable Factor A with levels i = 1 to a Factor B with levels j = 1 to b Y ijk is the k th observation in cell (i, j) k = 1 to n ij Have balanced designs with n = n ij

4
Two-way mixed model Two-way mixed model has –One fixed effect –One random effect Tests: –Again use EMS as guide –Two possible models Unrestricted mixed model (SAS) Restricted mixed model (Text)

5
KNNL Example KNNL Problem 25.15, p 1080 Y is fuel efficiency in miles per gallon Factor A represents four different drivers, a=4 levels Factor B represents five different cars of the same model, b=5 Each driver drove each car twice over the same 40-mile test course

6
Read and check the data data a1; infile 'c:\...\CH25PR15.TXT'; input mpg driver car; proc print data=a1; run;

7
The data Obs mpg driver car 1 25.3 1 1 2 25.2 1 1 3 28.9 1 2 4 30.0 1 2 5 24.8 1 3 6 25.1 1 3 7 28.4 1 4 8 27.9 1 4 9 27.1 1 5 10 26.6 1 5

8
Prepare the data for a plot data a1; set a1; if (driver eq 1)*(car eq 1) then dc='01_1A'; if (driver eq 1)*(car eq 2) then dc='02_1B'; ⋮ if (driver eq 4)*(car eq 5) then dc='20_4E';

9
Plot the data title1 'Plot of the data'; symbol1 v=circle i=none c=black; proc gplot data=a1; plot mpg*dc/frame; run;

11
Find the means proc means data=a1; output out=a2 mean=avmpg; var mpg; by driver car;

12
Plot the means title1 'Plot of the means'; symbol1 v='A' i=join c=black; symbol2 v='B' i=join c=black; symbol3 v='C' i=join c=black; symbol4 v='D' i=join c=black; symbol5 v='E' i=join c=black; proc gplot data=a2; plot avmpg*driver=car/frame; run;

14
Example Revisited Suppose that the four drivers were not randomly selected and there is interest in comparing the four drivers in the study Driver (A) is now a fixed effect Still consider Car (B) to be a random effect

15
Mixed effects model (unrestricted) Y ijk = μ + i + j + ( ) ij + ε ijk Σ i =0 (unknown constants) j ~ N(0, σ 2 ) ( ) ij ~ N(0, σ 2 ) ε ij ~ N(0, σ 2 ) σ Y 2 = σ 2 + σ 2 + σ 2

16
Mixed effects model (restricted) Y ijk = μ + i + j + ( ) ij + ε ijk Σ i =0 (unknown constants) Σ( b) ij =0 for all j ε ij ~ N(0, σ 2 ) σ Y 2 = σ 2 + ((a-1)/a) σ 2 + σ 2

17
Parameters There are a+3 parameters in this model –a fixed effects means –σ 2 –σ 2 –σ 2

18
ANOVA table The terms and layout of the ANOVA table are the same as what we used for the fixed effects model The expected mean squares (EMS) are different and vary based on the choice of unrestricted or restricted mixed model

19
EMS (unrestricted) E(MSA) = σ 2 + bnΣ i 2 /(a-1)+ n σ 2 E(MSB) = σ 2 + an σ 2 + n σ 2 E(MSAB) = σ 2 + n σ 2 E(MSE) = σ 2 Estimates of the variance components can be obtained from these equations, replacing E(MS) with table value, or other methods such as ML

20
EMS (restricted) E(MSA) = σ 2 + bnΣ i 2 /(a-1)+ n σ 2 E(MSB) = σ 2 + an σ 2 E(MSAB) = σ 2 + n σ 2 E(MSE) = σ 2 Estimates of the variance components can be obtained from these equations, replacing E(MS) with table value, or other methods such as ML Diff here

21
Hypotheses (unrestricted) H 0A : σ 2 = 0; H 1A : σ 2 ≠ 0 –H 0A is tested by F = MSA/MSAB with df a-1 and (a-1)(b-1) H 0B : σ 2 = 0; H 1B : σ 2 ≠ 0 –H 0B is tested by F = MSB/MSAB with df b-1 and (a-1)(b-1) H 0AB : σ 2 = 0; H 1AB : σ 2 ≠ 0 –H 0AB is tested by F = MSAB/MSE with df (a-1)(b-1) and ab(n-1)

22
Hypotheses (restricted) H 0A : σ 2 = 0; H 1A : σ 2 ≠ 0 –H 0A is tested by F = MSA/MSAB with df a-1 and (a-1)(b-1) H 0B : σ 2 = 0; H 1B : σ 2 ≠ 0 –H 0B is tested by F = MSB/MSE with df b-1 and ab(n-1) H 0AB : σ 2 = 0; H 1AB : σ 2 ≠ 0 –H 0AB is tested by F = MSAB/MSE with df (a-1)(b-1) and ab(n-1)

23
Comparison of Means To compare fixed levels of A, std error is Degrees of freedom for t tests and CIs are then (a-1)(b-1) This is true for both unrestricted and restricted mixed models

24
Using Proc Mixed proc mixed data=a1; class car driver; model mpg=driver; random car car*driver / vcorr; lsmeans driver / adjust=tukey; run; SAS considers unrestricted model only…results in slightly different variance estimates

25
SAS Output Covariance Parameter Estimates Cov ParmEstimate car2.9343 car*driver0.01406 Residual0.1757 Type 3 Tests of Fixed Effects Effect Num DF Den DFF ValuePr > F driver312458.26<.0001

26
SAS Output Least Squares Means EffectdriverEstimate Standard ErrorDFt ValuePr > |t| driver126.93000.77931234.56<.0001 driver234.15000.77931243.82<.0001 driver328.85000.77931237.02<.0001 driver430.26000.77931238.83<.0001

27
SAS Output Differences of Least Squares Means Effectdriver_driverEstiate Standard ErrorDFt ValuePr > |t|AdjustmentAdj P driver12-7.22000.201912-35.76<.0001 Tukey- Kramer <.0001 driver13-1.92000.201912-9.51<.0001 Tukey- Kramer <.0001 driver14-3.33000.201912-16.49<.0001 Tukey- Kramer <.0001 driver235.30000.20191226.25<.0001 Tukey- Kramer <.0001 driver243.89000.20191219.26<.0001 Tukey- Kramer <.0001 driver34-1.41000.201912-6.98<.0001Tukey- Kramer <.0001

28
Three-way models We can have zero, one, two, or three random effects EMS indicate how to do tests In some cases the situation is complicated and we need approximations of an F test, e.g. when all are random, use MS(AB)+MS(AC)- MS(ABC) to test A

29
Last slide Finish reading KNNL Chapter 25 We used program topic32.sas to generate the output for today

Similar presentations

OK

Testing Multiple Means and the Analysis of Variance (§8.1, 8.2, 8.6) Situations where comparing more than two means is important. The approach to testing.

Testing Multiple Means and the Analysis of Variance (§8.1, 8.2, 8.6) Situations where comparing more than two means is important. The approach to testing.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on social networking download Ppt on leadership challenges Ppt on file system implementation Ppt on abstract art pictures Ppt on charge coupled device for side Download ppt on abdul kalam Ppt on pre ignition knock Ppt on exponential functions Ppt on e banking in india Ppt on the development of the periodic table