Hello,
I am performing an analysis of a longitudinal dataset examining the rates of change in quantitative retinal measures between controls and individuals with multiple sclerosis (MS). I am performing these analyses with mixed-effects models with 2 levels (subject and eye) with random slopes in follow-up time.
I have found that age at study entry is associated with the rates of change in quantitative retinal measures, but this relationship differs for controls and MS individuals. I have performed analyses separately in each group including an age_baseline*time interaction term, as well as in one model including all individuals from both groups with baseline_age*time and a a three-way continuous*continuous*binary interaction term (baseline_age*time*diagnosis).
This model is as follows:
mixed y c.time##c.age_baseline c.time#i.diagnosis#c.age_baseline c.time##i.diagnosis c.age_baseline##i.diagnosis || id: || eye: time, mle cov(uns)
Following this, I have used margins to calculate and plot the rates of change of y by age in controls and MS as follows:
. margins diagnosis, dydx(time) at(baseline_age=(20(5)65)) post
Average marginal effects Number of obs = 3,661
Expression : Linear prediction, fixed portion, predict()
dy/dx w.r.t. : time
1._at : baseline_age = 20
2._at : baseline_age = 25
3._at : baseline_age = 30
4._at : baseline_age = 35
5._at : baseline_age = 40
6._at : baseline_age = 45
7._at : baseline_age = 50
8._at : baseline_age = 55
9._at : baseline_age = 60
10._at : baseline_age = 65
-------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
time |
_at#diagnosis |
1 0 | -.3512082 .1568349 -2.24 0.025 -.6585989 -.0438175
1 1 | -.9290963 .0845973 -10.98 0.000 -1.094904 -.7632886
2 0 | -.3621894 .1248761 -2.90 0.004 -.606942 -.1174367
2 1 | -.8745289 .0708776 -12.34 0.000 -1.013446 -.7356114
3 0 | -.3731706 .0985601 -3.79 0.000 -.5663447 -.1799964
3 1 | -.8199615 .0578459 -14.17 0.000 -.9333374 -.7065857
4 0 | -.3841518 .0834104 -4.61 0.000 -.5476333 -.2206703
4 1 | -.7653942 .0460895 -16.61 0.000 -.8557279 -.6750605
5 0 | -.395133 .0855786 -4.62 0.000 -.562864 -.227402
5 1 | -.7108268 .0368499 -19.29 0.000 -.7830512 -.6386024
6 0 | -.4061142 .1039869 -3.91 0.000 -.6099248 -.2023036
6 1 | -.6562594 .0323599 -20.28 0.000 -.7196837 -.5928351
7 0 | -.4170954 .1320077 -3.16 0.002 -.6758257 -.1583651
7 1 | -.601692 .0345254 -17.43 0.000 -.6693605 -.5340236
8 0 | -.4280766 .1648088 -2.60 0.009 -.751096 -.1050572
8 1 | -.5471247 .0423369 -12.92 0.000 -.6301036 -.4641458
9 0 | -.4390579 .2000526 -2.19 0.028 -.8311538 -.0469619
9 1 | -.4925573 .0533705 -9.23 0.000 -.5971616 -.387953
10 0 | -.4500391 .2366503 -1.90 0.057 -.913865 .0137869
10 1 | -.4379899 .0660302 -6.63 0.000 -.5674068 -.308573
-------------------------------------------------------------------------------
And this is what the plot looks like:
So diseased individuals that are younger have faster decreases in the y variable than are expected with normal aging, but as their age increases, their rates of change approach those observed in the control group (normal aging).
I am now interested in calculating the differences, 95% CI and p-values for the comparison between the rates of change of y between the control and MS groups, at specific ages (e.g. from 20-65 in 5-year increments). However, reading the instructions for the margins command it is not clear to me if this is possible to be obtained through that command.
I attempted to use the calculated marginal effects outlined above and the variance-covariance matrix [.matrix list e(V)] to calculate the p-values from Z-scores calculated as follows: (b0-b1)/(varb0 + varb1 - 2*covb0b1) but the results seem odd to me (i.e. p-values are much lower than expected).
I would greatly appreciate any input.
Thanks!
I am performing an analysis of a longitudinal dataset examining the rates of change in quantitative retinal measures between controls and individuals with multiple sclerosis (MS). I am performing these analyses with mixed-effects models with 2 levels (subject and eye) with random slopes in follow-up time.
I have found that age at study entry is associated with the rates of change in quantitative retinal measures, but this relationship differs for controls and MS individuals. I have performed analyses separately in each group including an age_baseline*time interaction term, as well as in one model including all individuals from both groups with baseline_age*time and a a three-way continuous*continuous*binary interaction term (baseline_age*time*diagnosis).
This model is as follows:
mixed y c.time##c.age_baseline c.time#i.diagnosis#c.age_baseline c.time##i.diagnosis c.age_baseline##i.diagnosis || id: || eye: time, mle cov(uns)
Following this, I have used margins to calculate and plot the rates of change of y by age in controls and MS as follows:
. margins diagnosis, dydx(time) at(baseline_age=(20(5)65)) post
Average marginal effects Number of obs = 3,661
Expression : Linear prediction, fixed portion, predict()
dy/dx w.r.t. : time
1._at : baseline_age = 20
2._at : baseline_age = 25
3._at : baseline_age = 30
4._at : baseline_age = 35
5._at : baseline_age = 40
6._at : baseline_age = 45
7._at : baseline_age = 50
8._at : baseline_age = 55
9._at : baseline_age = 60
10._at : baseline_age = 65
-------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
time |
_at#diagnosis |
1 0 | -.3512082 .1568349 -2.24 0.025 -.6585989 -.0438175
1 1 | -.9290963 .0845973 -10.98 0.000 -1.094904 -.7632886
2 0 | -.3621894 .1248761 -2.90 0.004 -.606942 -.1174367
2 1 | -.8745289 .0708776 -12.34 0.000 -1.013446 -.7356114
3 0 | -.3731706 .0985601 -3.79 0.000 -.5663447 -.1799964
3 1 | -.8199615 .0578459 -14.17 0.000 -.9333374 -.7065857
4 0 | -.3841518 .0834104 -4.61 0.000 -.5476333 -.2206703
4 1 | -.7653942 .0460895 -16.61 0.000 -.8557279 -.6750605
5 0 | -.395133 .0855786 -4.62 0.000 -.562864 -.227402
5 1 | -.7108268 .0368499 -19.29 0.000 -.7830512 -.6386024
6 0 | -.4061142 .1039869 -3.91 0.000 -.6099248 -.2023036
6 1 | -.6562594 .0323599 -20.28 0.000 -.7196837 -.5928351
7 0 | -.4170954 .1320077 -3.16 0.002 -.6758257 -.1583651
7 1 | -.601692 .0345254 -17.43 0.000 -.6693605 -.5340236
8 0 | -.4280766 .1648088 -2.60 0.009 -.751096 -.1050572
8 1 | -.5471247 .0423369 -12.92 0.000 -.6301036 -.4641458
9 0 | -.4390579 .2000526 -2.19 0.028 -.8311538 -.0469619
9 1 | -.4925573 .0533705 -9.23 0.000 -.5971616 -.387953
10 0 | -.4500391 .2366503 -1.90 0.057 -.913865 .0137869
10 1 | -.4379899 .0660302 -6.63 0.000 -.5674068 -.308573
-------------------------------------------------------------------------------
And this is what the plot looks like:
So diseased individuals that are younger have faster decreases in the y variable than are expected with normal aging, but as their age increases, their rates of change approach those observed in the control group (normal aging).
I am now interested in calculating the differences, 95% CI and p-values for the comparison between the rates of change of y between the control and MS groups, at specific ages (e.g. from 20-65 in 5-year increments). However, reading the instructions for the margins command it is not clear to me if this is possible to be obtained through that command.
I attempted to use the calculated marginal effects outlined above and the variance-covariance matrix [.matrix list e(V)] to calculate the p-values from Z-scores calculated as follows: (b0-b1)/(varb0 + varb1 - 2*covb0b1) but the results seem odd to me (i.e. p-values are much lower than expected).
I would greatly appreciate any input.
Thanks!
Comment