I was trying to do repeated measure ANOVA using Proc mixed to analyze a
longitudinal data. In the data, there are about 40 subjects who had been
followed at 4 different time points. A few subjects had missing data at some
time points.
My code is as following:
proc mixed;
class id time;
model dependent = a b time / ddfm=kr solution;
repeated time / subject=id type=un;
run;
* a is time-variant continuous covaraite, b is time-invariant continuous covariate;
SAS output:
effect time estimate standarderror DF tvalue P
Intercept 3.3442 1.5310 74.2 2.18 0.0321
a -0.00269 0.02882 73.5 -0.09 0.9258
time 0 -1.0780 0.7036 76.2 -1.53 0.1296
time 1 -1.1664 0.5936 75.2 -1.97 0.0531
time 2 -0.7012 0.3935 70.6 -1.78 0.0791
time 3 0 . . . .
b 0.000704 0.000153 38.3 4.59 <.0001
Type 3 test fixed effects
Effect NuMDF DenDF F-value P
a 1 73.5 0.01 0.9258
time 3 31.8 7.87 0.0005
b 1 38.3 21.08 <.0001
from the upper panel ("solution"), the time effect is not significant. Coefficients of "time" have p-values > 0.05. But in the lower panel (type 3 test of fixed effects), time effect is significant. P of time is 0.0005.
I don't understand why they are not consistent. which one should I use?
Thank you.
It is important to know what is being tested. In the solution panel, each level's estimate is tested against zero, whereas in the Type 3 tests, the 4 effects are tested against one another (a 3 df test). In other words, are any of the time points 0, 1, and 2 different from time point 3. You get these by adding the estimate for each time point to the intercept. The joint F test is the one that probably addresses your question--are any of the responses different by time?
Steve Denham
No conflict at all, as indicated by Steve.Each of the first three time parameters is being tested versus 0 (which means, in this, case, with an over-parameterized model: Is the expected value for each time different from the last time?). The type 3 test consists of three contrasts simultaneously. Perhaps the mean for one time is different from a different time, or the mean of the first two times is different from the mean of the second two times, and so on and so forth.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.