Stata Technical Bulletin
13
We can plot the function of age:
. gen ageeff = iagecont*-bEiagecont] + ages45*-b[ages45] +
ages55*.b[ages55] + ages65*.b[ages65]
(7 missing values generated)
. graph ageeff iagecont, sy(.) connect(1) sort
We see (Figure 1) that the age effect gets a little stronger after 45 but flattens out around 65.
It is worth noting that a repeated measures ANOVA would not be very satisfying for determining cross-sectional effects.
Although it would gain power from the longitudinal observations, it would also lose power because most observations are missing
at least one time point and those observations would be unusable. In fact, we can find out how many observations would be lost:
. gen byte mhimiss = (mhiθ==.) + (mhi3mo==.) + (mhilyr==.) +
(mhi2yr==.) + (mhi4yr==.)
. tab mhimiss
mhimiss∣ |
Freq. |
Percent |
Cum. |
— | |||
0 I |
61S |
15.97 |
15.97 |
1 I |
909 |
23.49 |
39.47 |
2 I |
360 |
9.30 |
48.77 |
3 I |
854 |
22.07 |
70.85 |
4 I |
948 |
24.50 |
95.35 |
5 I |
180 |
4.65 |
100.00 |
Total I 3869 100.00
There are only 618 observations (out of 3,869) with data defined for all time points. The repeated measures ANOVA approach
would ignore 84% of our data! Nor would that be the end of our problems.
In this study, data are lost for three reasons: (1) one of the two baseline measures was not collected for a random half of
the sample; (2) the original investigators threw out approximately half the sample between baseline and the first year follow-up;
and (3) approximately 23% of the remaining sample was lost to follow-up. Repeated measures ANOVA cannot use observations
with missing values. If we used that technique, we would have to be concerned with biases introduced by all three reasons for
missing data and, in particular, by the observations lost to follow-up. (It might be more difficult to follow-up a patient with poor
mental health.)
Even without repeated measures ANOVA, one can examine longitudinal effects by looking at specific changes over time.
Below, I examine the change from baseline to 4 years out (changeθ) and the change from 3 months out to 2 years out (change3):
. gen changeθ = mhi4 - mhiθ
(3158 missing values generated)
. reg changeθ imale iagecont married inonwht
(obs=688)
Source I |
SS |
df |
MS |
Number of obs Prob > F Prob > It I |
= 688 = 14.35 = 0.0000 = 0.0775 = 0.0721 = 20.328 Mean | |
Model I Residual ∣ |
23724.4373 282236.805 |
4 683 |
5931.10932 413.231047 | |||
Total I Variable ∣ |
305961.242 Coefficient |
687 445.358431 Std. Error |
t | |||
changeθ I |
4.854651 | |||||
imale I _cons I |
-4.751704 -.3240794 -.9881201 -2.38699 25.79293 |
1.666875 |
-2.851 -6.474 -0.598 -1.121 8.496 |
0.004 0.000 0.550 0.263 0.000 |
.4171512 55.49571 1 — |
. gen change3 = mhi2 - mhi3mo
(2125 missing values generated)
. reg change3 imale iagecont married inonwht
(obs=1672)
Source I SS df MS
Number of obs = 1672
F( 4, 1667) = 15.57
Prob > F = 0.0000
R-square = 0.0360
Adj R-square = 0.0337
Root MSE = 16.149
---------+------------------------------
Model I 16247.3659 4 4061.84149
Residual ∣ 434741.385 1667 260.792673
---------+------------------------------
Total I 450988.751 1671 269.891533