1 / 66

Chapter 7 More on Mixed Models

Longitudinal Data Fall 2006. Chapter 7 More on Mixed Models. Instructors Alan Hubbard Nick Jewell. General Method for Choosing Random Effects/Correlation Model. Choose fixed effects model – more elaborate the better.

scott
Download Presentation

Chapter 7 More on Mixed Models

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Longitudinal DataFall 2006 Chapter 7 More on Mixed Models Instructors Alan Hubbard Nick Jewell

  2. General Method for Choosing Random Effects/Correlation Model • Choose fixed effects model – more elaborate the better. • For every combination of random effects and correlation you would consider, fit the model using the same fixed effects model, record Aikake Information Criterion (AIC) – which is a fit statistic penalized by the number of parameters. • Choose the model with the smallest AIC. AIC = -2*loglik+2*p, p is the number of parameters

  3. Implicit vs. Explicit Variance-covariance models • Two ways to generate a variance-covariance model • Implicit – by proposing a random effects (random coefficients) model – use the “random” option in PROC MIXED • Explicit – by proposing a correlation structure on the errors (the e’s) within a subject – use the “repeated” option in PROC MIXED. • In terms of estimating the coefficients (fixed effects) and deriving the inference (SE’s), the only thing that matters (with respect to 1 and 2) is the variance-covariance model they imply.

  4. Examples of var-cov. models

  5. Example: Simple random effects and exchangeable. • Assume 2 observations per subject. A simple random effects model: • Var(eij)= 2e • Var(0i)= 20 • Get by either doing • random int / sub=id • repeated / type=exch sub=id;

  6. Berkeley Orthokeratology Study • 59 subjects • 31 Tx, 28 controls • Two measurements, one per eye (3 subjects with missing measurement on left eye) • Cluster design – individual is the cluster, eyes are the elements of the cluster, and clusters assigned randomly to treatment.

  7. What it looks like in Wide Format group patnum subseq2 lmhor2 lmvert2 lscmar2 pach2 subseq1 lmhor1 lmvert1 lscmar1 pach1 1 1 3 1.13 0.00 0.25 -0.279 0.000 1.38 -0.12 -0.25 -0.250 0.009 2 1 4 0.88 -1.75 -1.38 -0.107 -0.015 0.88 -1.62 -0.75 -0.331 -0.002 3 1 9 0.12 -0.38 0.38 -0.015 0.006 0.25 -1.00 0.75 -0.084 -0.001 4 1 11 2.25 -1.13 -0.50 -0.755 -0.019 1.88 -0.75 -0.50 -0.477 -0.011 5 1 18 0.87 -0.25 -0.50 0.104 0.010 1.00 -0.25 -0.50 -0.231 0.012 • group is treatment (1=Tx, 2=Control) • patnum is id • lmhor-pach are acuity measurements on eye (outcome measurements) • the lmhor1 is right eye, lmhor2 is left, etc.

  8. BOK in Long Format group patnum subseq lmhor lmvert lscmar pach eye 1 1 3 1.38 -0.12 -0.25 -0.250 0.009 1 2 1 3 1.13 0.00 0.25 -0.279 0.000 2 3 1 4 0.88 -1.62 -0.75 -0.331 -0.002 1 4 1 4 0.88 -1.75 -1.38 -0.107 -0.015 2 5 1 9 0.25 -1.00 0.75 -0.084 -0.001 1 • lscmar will be the outcome of interest

  9. Model 1 • Ignoring the possibility for a fixed (systematic) effect associated with eye (right vs. left), a simple model is as follows: for the ith individual, the jth eye (measurement). • Xij = 1 if group = 1(Tx), 0 otherwise

  10. Model 1, cont. • E(eij)=0, cov(eij, eij’)=0, jj’. • Var(eij)= 2e . • What does V0 look like for this model? • How do you interpret 0, 1?

  11. Model 1 using OLS in SAS Code ********************************************************; * PROC MIXED, PURE; ********************************************************; proc mixed data=temp0 ; class patnum; model lscmar = groupnew / s; run; Output Covariance Parameter Estimates Cov Parm Estimate Residual 0.05532 Fit Statistics -2 Res Log Likelihood 1.7 AIC (smaller is better) 3.7 AICC (smaller is better) 3.7 BIC (smaller is better) 6.4

  12. Model 1 using OLS in SAS Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept -0.2004 0.03231 113 -6.20 <.0001 groupnew -0.07365 0.04400 113 -1.67 0.0969

  13. Model 1 using STATA Solution for Fixed Effects . xtmixed lscmar groupnew Mixed-effects REML regression Number of obs = 115 Wald chi2(1) = 2.80 Log restricted-likelihood = -.84020254 Prob > chi2 = 0.0941 ------------------------------------------------------------------------------ lscmar | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- groupnew | -.0736549 .0439994 -1.67 0.094 -.1598921 .0125823 _cons | -.2003774 .0323068 -6.20 0.000 -.2636975 -.1370572 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ sd(Residual) | .2351969 .0155084 .2066831 .2676443 ------------------------------------------------------------------------------ . * Get AIC . estat ic ------------------------------------------------------------------------------ Model | Obs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- . | 115 . -.8402025 3 7.680405 15.9152 ------------------------------------------------------------------------------

  14. Model 2 • Random Effects Model 1 • How does one interpret the parameters, 0, 0i, and 1?

  15. Model 2, cont. • E(eij)=0, cov(eij, eij’)=0, jj’. • Var(eij)= 2e • Var(0i)= 20 • cov(eij, 0i)= 0. • What does V0 look like for this model?

  16. Model 2 - Using SAS Code ********************************************************; * PROC MIXED, Random Intercept; ********************************************************; proc mixed data=temp0 ; class patnum; model lscmar = groupnew / s; random int / sub=patnum s; run; Output Covariance Parameter Estimates Cov Parm Subject Estimate Intercept patnum 0.03412 Residual 0.02131 Fit Statistics -2 Res Log Likelihood -25.7 AIC (smaller is better) -21.7 AICC (smaller is better) -21.6 BIC (smaller is better) -17.5

  17. Model 2 - Using SAS (results) Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept -0.1982 0.04041 57 -4.91 <.0001 groupnew -0.07580 0.05547 56 -1.37 0.1773 Solution for Random Effects Std Err Effect patnum Estimate Pred DF t Value Pr > |t| Intercept 1 0.05200 0.09523 56 0.55 0.5872 Intercept 2 0.1053 0.09523 56 1.11 0.2734 Intercept 3 0.006883 0.09465 56 0.07 0.9423 Intercept 4 0.04117 0.09465 56 0.44 0.6652 Intercept 7 0.04056 0.09523 56 0.43 0.6717 Intercept 9 0.1745 0.09465 56 1.84 0.0705 Intercept 11 -0.2598 0.09465 56 -2.75 0.0081 Intercept 12 0.2387 0.09523 56 2.51 0.0151 Intercept 16 -0.2414 0.09523 56 -2.53 0.0141 Intercept 17 -0.2338 0.09523 56 -2.45 0.0172 Intercept 18 0.1593 0.09465 56 1.68 0.0980 Intercept 19 0.2317 0.09465 56 2.45 0.0175

  18. Model 2 - Using STATA . **** Model 2 . xtmixed lscmar groupnew || patnum: Mixed-effects REML regression Number of obs = 115 Group variable: patnum Number of groups = 59 Obs per group: min = 1 avg = 1.9 max = 2 Wald chi2(1) = 1.87 Log restricted-likelihood = 12.841372 Prob > chi2 = 0.1718 ------------------------------------------------------------------------------ lscmar | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- groupnew | -.0758002 .0554745 -1.37 0.172 -.1845281 .0329278 _cons | -.1982321 .0404092 -4.91 0.000 -.2774327 -.1190315 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ patnum: Identity | sd(_cons) | .1847303 .0233551 .1441857 .2366759 -----------------------------+------------------------------------------------ sd(Residual) | .1459762 .0136863 .1214719 .1754237 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 27.36 Prob >= chibar2 = 0.0000 . estat ic ------------------------------------------------------------------------------ Model | Obs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- . | 115 . 12.84137 4 -17.68274 -6.703015 ------------------------------------------------------------------------------

  19. Model 2 - Using STATA (get Random Effects) . predict b0i, reffects . sort patnum . by patnum: gen cntpat = _n . list patnum b0i if cntpat==1 +--------------------+ | patnum b0i | |--------------------| 1. | 1 .0519975 | 3. | 2 .1053423 | 5. | 3 .0068832 | 7. | 4 .0411763 | 9. | 7 .0405665 | |--------------------| 11. | 9 .1745383 | 13. | 11 -.2598408 | 15. | 12 .2387043 | 17. | 16 -.2413989 | 19. | 17 -.2337782 | |--------------------| 21. | 18 .1592969 | 23. | 19 .2316934 | 25. | 20 -.2604506 | 27. | 21 .1745383 | 29. | 22 -.0851748 | |--------------------| 31. | 23 .0253251 | 33. | 24 -.1988753 |

  20. Model 2.5 • Model

  21. Model 2.5 - Using SAS Code ********************************************************; * PROC MIXED, Using Repeated Statement; ********************************************************; proc mixed data=temp1 ; class patnum; model lscmar = groupnew / s; repeated / sub=patnum type=cs; run; Output Convergence criteria met. Covariance Parameter Estimates Cov Parm Subject Estimate CS patnum 0.03412 Residual 0.02131 Fit Statistics -2 Res Log Likelihood -25.7 AIC (smaller is better) -21.7 AICC (smaller is better) -21.6 BIC (smaller is better) -17.5

  22. Model 2.5 - Using SAS (results) Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept -0.1982 0.04041 57 -4.91 <.0001 groupnew -0.07580 0.05547 57 -1.37 0.1772

  23. Model 2.75 – V0 different by covariate values • Model

  24. Model 2.75 - Using SAS Code ********************************************************; * PROC MIXED, Repeated with groups; ********************************************************; proc mixed data=temp1 ; class group2 patnum; model lscmar = groupnew / s; repeated / sub=patnum type=cs group=group2; run; Output Covariance Parameter Estimates Cov Parm Subject Group Estimate Variance patnum group2 0 0.01723 CS patnum group2 0 0.02179 Variance patnum group2 1 0.02464 CS patnum group2 1 0.04518 Fit Statistics -2 Res Log Likelihood -29.3 AIC (smaller is better) -21.3 AICC (smaller is better) -21.0 BIC (smaller is better) -13.0

  25. Model 2.75 - Using SAS (results) Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept -0.1984 0.03335 57 -5.95 <.0001 groupnew -0.07561 0.05447 57 -1.39 0.1705

  26. Comparing Models

  27. Mixed Model (LME) pH vs. CO2 in Eyes

  28. pH vs. CO2 • 18 subjects • 2 visits per subject • Two measurements per visit (one per eye). • The levels of CO2 were randomly assigned to the 4 measurements.

  29. Data id co2 ph prph visit eye 1 1 0 7.432 76.4 1 1 2 1 5 6.956 59.4 1 2 3 1 3 7.232 80.3 2 1 4 1 7 6.982 74.2 2 2 5 2 0 7.594 67.8 1 1 6 2 7 6.929 61.1 1 2 7 2 3 7.230 73.4 2 1 8 2 5 7.073 65.9 2 2 9 3 3 7.329 87.6 1 1 10 3 7 6.963 55.8 1 2

  30. Look at Data

  31. Model 1 - OLS • First model is as follows: for the ith individual, the jth visit, kth eye. • Xijk =CO2 • How does one interpret the parameters, 0, 1, and 2?

  32. Model 1, cont. • E(eijk)=0, cov(eijk, eij’k’)=0, jj’ or kk. • Var(eijk)= 2e . • What does V0 look like for this model?

  33. Model 1 using SAS ********************************************************; * PROC MIXED, Model 1; ********************************************************; procmixeddata=rep2001.phlong; class id; model ph = co2 co22 / s; estimate'3' co2 3 co22 9 / cl; estimate'5' co2 5 co22 25 / cl; estimate'7' co2 7 co22 49 / cl; run;

  34. Model 1 Results using SAS Covariance Parameter Estimates Cov Parm Estimate Residual 0.007792 Fit Statistics -2 Res Log Likelihood -117.1 AIC (smaller is better) -115.1 AICC (smaller is better) -115.0 BIC (smaller is better) -112.9 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 7.6462 0.02119 67 360.81 <.0001 CO2 -0.1373 0.01379 67 -9.96 <.0001 CO22 0.007339 0.001910 67 3.84 0.0003

  35. Model 1- Estimate Command Results Estimates Standard Label Estimate Error DF t Value Pr > |t| Alpha Lower Upper 3 -0.3458 0.02549 67 -13.57 <.0001 0.05 -0.3967 -0.2949 5 -0.5028 0.02733 67 -18.40 <.0001 0.05 -0.5574 -0.4483 7 -0.6011 0.02865 67 -20.98 <.0001 0.05 -0.6583 -0.5439

  36. Model 1 Using STATA . xtmixed ph co2 co22 Mixed-effects REML regression Number of obs = 70 Wald chi2(2) = 463.58 Log restricted-likelihood = 58.499944 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ ph | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- co2 | -.1373144 .0137997 -9.95 0.000 -.1643613 -.1102674 co22 | .0073496 .0019106 3.85 0.000 .0036049 .0110942 _cons | 7.646126 .0212018 360.64 0.000 7.604572 7.687681 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ sd(Residual) | .0883141 .0074639 .0748325 .1042245 ------------------------------------------------------------------------------ . estat ic ------------------------------------------------------------------------------ Model | Obs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- . | 70 . 58.49994 4 -108.9999 -100.0059 ------------------------------------------------------------------------------

  37. Model 1 Using STATA (lincom) . lincom 3*co2+9*co22 ( 1) 3 [ph]co2 + 9 [ph]co22 = 0 ------------------------------------------------------------------------------ ph | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.3457971 .0254904 -13.57 0.000 -.3957574 -.2958368 ------------------------------------------------------------------------------ . lincom 5*co2+25*co22 ( 1) 5 [ph]co2 + 25 [ph]co22 = 0 ------------------------------------------------------------------------------ ph | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.502833 .0273284 -18.40 0.000 -.5563957 -.4492703 ------------------------------------------------------------------------------ . lincom 7*co2+49*co22 ( 1) 7 [ph]co2 + 49 [ph]co22 = 0 ------------------------------------------------------------------------------ ph | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.6010725 .0286516 -20.98 0.000 -.6572287 -.5449163 ------------------------------------------------------------------------------

  38. Model 2 • How does one interpret the parameters, 0, 0i, and 1, 2?

  39. Model 2, cont. • E(eijk)=0, cov(eijk, eij’k’)=0, jj’ or kk’ • Var(eijk)= 2e • Var(0i)= 2id. • cov(eijk, 0i)= 0. • What does V0 look like for this model?

  40. Model 2 using SAS ********************************************************; * PROC MIXED, Model 2; ********************************************************; procmixeddata=rep2001.phlong; class id; model ph = co2 co22 / s; random int / sub=id; estimate'3' co2 3 co22 9 / cl; estimate'5' co2 5 co22 25 / cl; estimate'7' co2 7 co22 49 / cl; run;

  41. Model 2 Results using SAS Covariance Parameter Estimates Cov Parm Subject Estimate Intercept ID 0.005052 Residual 0.002696 Fit Statistics -2 Res Log Likelihood -152.4 AIC (smaller is better) -148.4 AICC (smaller is better) -148.2 BIC (smaller is better) -146.6 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 7.6458 0.02098 17 364.50 <.0001 CO2 -0.1373 0.008115 50 -16.92 <.0001 CO22 0.007344 0.001123 50 6.54 <.0001

  42. Model 2- Estimate Command Results Estimates Standard Label Estimate Error DF t Value Pr > |t| Alpha Lower Upper 3 -0.3456 0.01484 50 -23.28 <.0001 0.05 -0.3755 -0.3158 5 -0.5025 0.01596 50 -31.50 <.0001 0.05 -0.5346 -0.4705 7 -0.6006 0.01681 50 -35.72 <.0001 0.05 -0.6343 -0.5668

  43. Model 2 Using STATA . xtmixed ph co2 co22 || id: Mixed-effects REML regression Number of obs = 70 Group variable: id Number of groups = 18 Obs per group: min = 2 avg = 3.9 max = 4 Wald chi2(2) = 1346.68 Log restricted-likelihood = 76.647278 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ ph | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- co2 | -.1372775 .0080292 -17.10 0.000 -.1530143 -.1215406 co22 | .0073546 .0011116 6.62 0.000 .0051759 .0095334 _cons | 7.64567 .0209821 364.39 0.000 7.604546 7.686795 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ id: Identity | sd(_cons) | .0715285 .0138821 .0488968 .1046354 -----------------------------+------------------------------------------------ sd(Residual) | .0513741 .0051277 .0422459 .0624746 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 36.29 Prob >= chibar2 = 0.0000 . estat ic ------------------------------------------------------------------------------ Model | Obs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- . | 70 . 76.64728 5 -143.2946 -132.0521 ------------------------------------------------------------------------------

  44. Model 2.5

  45. Model 2.5 using SAS ********************************************************; * PROC MIXED, Model 2.5; ********************************************************; proc mixed data=temp0; class id; model ph = co2 co22 / s; repeated/ sub=id type=cs; estimate '3' co2 3 co22 9 / cl; estimate '5' co2 5 co22 25 / cl; estimate '7' co2 7 co22 49 / cl; run;

  46. Model 2.5 Results using SAS Covariance Parameter Estimates Cov Parm Subject Estimate CS id 0.005115 Residual 0.002640 Fit Statistics -2 Res Log Likelihood -153.3 AIC (smaller is better) -149.3 AICC (smaller is better) -149.1 BIC (smaller is better) -147.5 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 7.6457 0.02098 17 364.42 <.0001 co2 -0.1373 0.008030 50 -17.10 <.0001 co22 0.007355 0.001112 50 6.62 <.0001

  47. Model 3 • How does one interpret the parameters, 0, 0i, 0i jand 1, 2?

  48. Model 3, cont. • E(eijk)=0, cov(eijk, eij’k’)=0, jj’ or kk’ • Var(eijk)= 2e • Var(0i)= 2id • Var(0ij)= 2visit • cov(eijk, 0i)= 0, cov(eijk, 0ij)= 0, cov(0i, 0ij)= 0 • What does V0 look like for this model?

  49. Model 3 using SAS ********************************************************; * PROC MIXED, Model 3; ********************************************************; procmixeddata=rep2001.phlong; class id visit; model ph = co2 co22 / s; random id visit(id); estimate'3' co2 3 co22 9 / cl; estimate'5' co2 5 co22 25 / cl; estimate'7' co2 7 co22 49 / cl; run;

  50. Model 3 Results using SAS Covariance Parameter Estimates Cov Parm Estimate ID 0.004928 VISIT(ID) 0.000395 Residual 0.002433 Fit Statistics -2 Res Log Likelihood -152.8 AIC (smaller is better) -146.8 AICC (smaller is better) -146.5 BIC (smaller is better) -144.2 Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| Intercept 7.6446 0.02092 17 365.50 <.0001 CO2 -0.1365 0.008061 33 -16.94 <.0001 CO22 0.007262 0.001115 33 6.51 <.0001

More Related