03-10-2016 02:42 PM
Hi, I ran into some problems with adding a continous covariate in repeated measures using proc mixed, and there is not much information on the internet.
The situation is like measuring weight gain over time and I want to add initial weights as covariate, then compare weight gain between time points. Analysis ran well without covariate, however, when I added in the covariate, lsmeans of weight gain at different time points were not estimatable.
here are the codes I used
input id gain time blk wt;
1 6.00 1 2 90
1 4.80 1 1 83
2 5.80 1 2 74
2 4.40 1 1 87
1 5.25 2 2 90
1 4.00 2 1 83
2 5.00 2 2 74
2 4.70 2 1 87
1 5.25 3 2 90
1 4.50 3 1 83
2 4.25 3 2 74
2 5.10 3 1 87
proc mixed data=survey;
class id time blk;
model gain = time blk id(blk) wt;
repeated time / type = ar(1) subject = id(blk);
lsmeans time / pdiff adjust = bon;
Can anyone help? Thanks.
03-30-2016 11:44 AM
First, recognize that blk is a random effect, and that you have to have a unique record for each subject.
proc mixed data=survey; class id time blk; model gain = time wt; random intercept id/subject=blk; repeated time / type = ar(1) subject = id(blk); lsmeans time / pdiff adjust = bon; run;
This gives an AR+RE model for the response variable.
HOWEVER, modeling a change variable with a covariate that is one of the elements of the change is looking for trouble. See the following link
and especially the section:
In a two-group parallel design, analysis of change is not recommended at all. The response variable should be the final measurement and the baseline measurement should be adjusted for as a covariate using analysis of covariance, with treatment assigned as one of the other variables. Besides the issues listed above, change scores are affected by regression to the mean. The slope of the baseline value may not be 1.0.
What this means is that you are adjusting for the initial body weight twice in your proposed analysis.