Statistics 262: Intermediate Biostatistics Mixed models; Modeling change 1 Within vs. Between subject effects… A significant chemical effect (time-dependent predictor) could either represent a between-subjects effect or a within-subjects effect. Because these data were made-up, we happened to know that there was primarily a within-subjects effect… Example 1: last week’s example. Solution for Fixed Effects CHEM: -.01283 Standard Effect Estimate Error DF t Value Pr > |t| 38.1287 4.1727 5 9.14 0.0003 time -0.08163 0.3234 16 -0.25 0.8039 chem -0.01283 0.003125 16 -4.11 0.0008 Intercept 2 Example 1..from last time… 6 patients with depression are given a drug that increases levels of a “happy chemical” in the brain. At baseline, all 6 patients have similar levels of this happy chemical and scores >=14 on a depression scale. Researchers measure depression score and brain-chemical levels at three subsequent time points: at 2 months, 3 months, and 6 months post-baseline. Here are the data in broad form: id time1 time2 time3 time4 chem1 chem2 chem3 chem4 1 20 18 15 20 1000 1100 1200 1300 2 22 24 18 22 1000 1000 1005 950 3 14 10 24 10 1000 1999 800 1700 4 38 34 32 34 1000 1100 1150 1100 5 25 29 25 29 1000 1000 1050 1010 6 30 28 26 14 1000 1100 1109 1500 3 Example 2… Same as example 1, but made up to have more between-subjects effect than within-subjects effect. id 1 2 3 4 5 6 time1 50 22 44 38 15 50 time2 48 24 40 34 19 58 time3 45 18 34 32 15 56 time4 40 22 40 34 19 54 chem1 chem2 chem3 chem4 200 900 500 700 1000 100 350 920 459 770 1000 110 400 805 880 950 1050 210 500 950 500 800 1010 220 4 Example 3… Same as example 1, but made up to have ONLY between-subjects effect id 1 2 3 4 5 6 time1 51 47 42 31 26 19 time2 48 43 42 32 27 20 time3 45 46 41 31 26 21 time4 50 45 38 32 28 18 chem1 chem2 chem3 chem4 510 710 910 1105 1505 1750 520 720 890 1110 1505 1600 510 690 900 1109 1510 1680 525 680 905 1090 1590 1740 5 Example 2 (more between-subjects effects): showing two subjects… id=1: score id=1: chem id=2: chem id=2: score Example 2: Example 2: Example 2: Example 2: Example 2: Example 2: Example 3:all between-subjects effects Example 3: Example 3: Example 3: Example 3: Example 3: Results, example 1… proc mixed data=hrp262.long2; model score=chem time / solution; random int/subject=id; run; Example 1: significant chem effect. Solution for Fixed Effects CHEM: -.01283 Standard Effect Estimate Error DF t Value Pr > |t| 38.1287 4.1727 5 9.14 0.0003 chem -0.01283 0.003125 16 -4.11 0.0008 time -0.08163 0.3234 16 -0.25 0.8039 Intercept 19 Results, example 2… proc mixed data=hrp262.long2; model score=chem time / solution; random int/subject=id; run; Example 2: significant chem effect CHEM: -.02644 Solution for Fixed Effects Effect Estimate Standard Error Intercept chem time 52.0159 -0.02644 0.1009 4.2057 0.005403 0.2966 DF t Value 5 16 16 12.37 -4.89 0.34 Pr > |t| <.0001 0.0002 0.7381 20 Results, example 3… proc mixed data=hrp262.long3; model score=chem time / solution; random int/subject=id; run; Example 3: significant chem effect CHEM: -.02354 The Mixed Procedure Solution for Fixed Effects Effect Estimate Intercept chem time 60.8810 -0.02354 -0.08592 Standard Error 2.4237 0.002066 0.1707 DF 5 16 16 t Value 25.12 -11.39 -0.50 Pr > |t| <.0001 <.0001 0.6217 21 All three examples give the same result… There’s no way to tell if change in chemical levels is causing change in depression score (which is what we probably care about). What to do?... 22 Options Examine graphs! Evaluate baseline relationship of chemical1 and score1 using regular linear regression Use only baseline value of chemical (chem1) as a predictor in GEE or Mixed and add a time*chem1 interaction to the model to evaluate change. Here, you will find a strong relationship only in examples 2 and 3, suggesting strong betweensubjects effects. Drawback: you still can’t rule out within-subjects effects (could have both) Here, you will find that chem1 main effect is significant but chem1*time is not in examples 2 and 3 Drawback: A significant time*chem1 interaction would indicate that baseline chemical levels predict change in depression score over time, which is slightly different than saying that change in chemical level predicts change in depression score. Correlate change in time-dependent predictor with change in repeated-measures outcome… Calculate overall change or percent change in outcome and regress this on overall change or percent change in the predictor: see chapter 8 of Twisk (2 time points only) OR model all the changes together (vector of changes)… 23 The change model score 2 score1 chem2 chem1 score3 score 2 chem3 chem2 ... 0 1 score 4 score3 chem4 chem3 24 SAS code to change data… data hrp262.change; set hrp262.broad; time=0; ctime=2; cscore=time2-time1; cchem=chem2-chem1; output; time=1; ctime=1; cscore=time3-time2; cchem=chem3-chem2; output; time=2; ctime=3; cscore=time4-time3; cchem=chem4-chem3; output; label cchem='change in chemical'; label cscore='change in depression score'; run; 25 id 1 2 3 4 5 6 time1 51 47 42 31 26 19 time2 48 43 42 32 27 20 time3 time4 45 46 41 31 26 21 50 45 38 32 28 18 id So, look at change in depression score as your outcome variable. All timedependent predictors also get a change score. 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 cscore -3 -3 5 -4 3 -1 0 -1 -3 1 -1 1 1 -1 2 1 1 -3 chem1 chem2 chem3 chem4 510 710 910 1105 1505 1750 520 720 890 1110 1505 1600 510 690 900 1109 1510 1680 525 680 905 1090 1590 1740 cchem 10 -10 15 10 -30 -10 -20 10 5 5 -1 -19 0 5 80 -150 80 60 time 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 Example 1: naïve linear regression cscore = -0.126817 - 0.011357*cchem 27 Example 2: naïve linear regression cscore = -0.167511 - 0.012043*cchem 28 Example 3: naïve linear regression cscore = -0.268792 - 0.004044*cchem 29 Modeling changes (mixed)… EXAMPLE 1: Effect Intercept time cchem EXAMPLE 2: Solution for Fixed Effects Standard Estimate Error DF t Value 0.3407 -0.4669 -0.01136 1.6018 1.2298 0.002336 5 10 10 Effect Solution for Fixed Effects Standard Estimate Error DF Intercept time cchem -0.04810 -0.1151 -0.01218 Effect EXAMPLE 3: Intercept time cchem 0.21 -0.38 -4.86 Pr > |t| 0.8400 0.7122 0.0007 t Value Pr > |t| 5 10 10 -0.03 -0.09 -1.93 0.9773 0.9269 0.0830 Solution for Fixed Effects Standard Estimate Error DF t Value Pr > |t| -0.8621 0.6023 -0.00807 1.6106 1.2225 0.006324 0.9697 0.7825 0.01334 5 10 10 -0.89 0.77 -0.60 0.4147 0.4592 0.5587 30 Modeling changes (GEE)… EXAMPLE 1: Analysis Of GEE Parameter Estimates Standard 95% Confidence Parameter Estimate Error Limits Intercept time cchem EXAMPLE 2: 1.2757 1.2698 0.0011 -2.1596 -2.9557 -0.0136 2.8409 2.0219 -0.0091 Analysis Of GEE Parameter Estimates Standard 95% Confidence Parameter Estimate Error Limits Intercept time cchem EXAMPLE 3: 0.3407 -0.4669 -0.0114 -0.0481 -0.1151 -0.0122 1.6245 1.2030 0.0050 -3.2320 -2.4728 -0.0219 3.1358 2.2427 -0.0024 Analysis Of GEE Parameter Estimates Standard 95% Confidence Parameter Estimate Error Limits Intercept cchem time -0.7146 0.0060 0.2118 1.5997 -3.8498 0.0112 -0.0160 0.8366 -1.4280 2.4207 0.0280 1.8516 Z Pr > |Z| 0.27 -0.37 -9.93 0.7894 0.7131 <.0001 Z Pr > |Z| -0.03 -0.10 -2.45 0.9764 0.9238 0.0143 Z Pr > |Z| -0.45 0.53 0.25 0.6551 0.5955 0.8000 31 The change model score 2 score1 chem2 chem1 score3 score 2 chem3 chem2 (time) CORR Error 0 1 2 score 4 score3 chem4 chem3 In fact, it often turns out that the changes are not correlated within subjects (we’ve essentially already corrected for between subject variability by using change scores). scoreit 0 1 (chemit ) 2 (t ) Errorit e.g., just regular old linear regression, where each person contributes three “independent” observations… 32 The change model If time intervals are unequal and unbalanced, you might choose to include the change in time as a predictor in the model. Otherwise, you could face confounding by the time between measurements (which might be correlated with the time-dependent predictor)… scoreit 0 1 (chemit ) 2 (ti ) Errorit 33 SAS code proc genmod data=hrp262.change; class id; model cscore=time cchem; repeated subject=id / type=ind corrw; run; proc mixed data=hrp262.change; class id; model cscore=time cchem/ solution; run; Which are basically equivalent to good old linear regression… proc reg data=hrp262.change; model cscore=time cchem; run; 34 Another example… In the runners study, does weight gain increase BMD? 35 Weight (time-dependent predictor)… Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > |t| 0.8492 0.02757 150 30.80 <.0001 time 0.000274 0.000094 196 2.92 0.0039 pounds 0.001037 0.000205 196 5.05 <.0001 Intercept Weight has a highly significant relationship with spine BMD… Is this a between-subjects or within-subjects effect?? 36 Between vs. within subjects… Strong between-subjects effect (baseline comparison) Weak within-subjects effect (comparison of changes) Deletion of just a few subjects who gained large amounts of weight makes the line much less steep. Modeling changes… data hrp262.change; set hrp262.broad; dxa=1; ctime=(dxaday2-dxaday1)*12/365.25; cspine=spine2-spine1; cpounds=pounds2-pounds1; output; dxa=2; ctime=(dxaday3-dxaday2)*12/365.25; cspine=spine2-spine1; cpounds=pounds2-pounds1; output; run; proc mixed data=hrp262.bfitchange; class id ; model cspine= ctime random int cpounds /s; /subject=id; run; It makes more sense here to model time as the interval (in months) between DXA (bone) measurements rather than regular old time. The change in BMD between DXAs is correlated to the length of time between DXAs (which was supposed to be 1 year, but ended up being highly variable). It’s not unreasonable to believe that weight gain might also be related to the amount of time that’s passed. If, instead, dxa (clinical visit 1,2,3) or time (continuous) were put in the model, what would a significant effect 38 mean?