Hi all,
I am using Stata/SE 14.2 to analyse a randomized controlled trial. Respondents filled the Beck Depression Inventory (bdi) at times 0, 1 and 2. To control for baselines values of the outcome (i.e. control for regression to the mean), I am building the model without the treatment variable and using id: as the second level (following Twisk 2018). The data is in long format
mixed bdi i.time i.intervention#i.time || id:, var
The interaction intervention*time gives me the mean difference in bdi at time 1 and 2. But now I would like to obtain the predicted means of bdi at times 0, 1 and 2 to make a graph for the publication. For this, I am using predict with the option fitted to obtain means that incorporate both fixed and random effects.
predict predri, fitted
mean predri if time==0 & intervention==1
mean predri if time==0 & intervention==0
mean predri if time==1 & intervention==1
mean predri if time==1 & intervention==0
mean predri if time==2 & intervention==1
mean predri if time==2 & intervention==0
However, I obtain exactly the same means as the unadjusted ones using tabstat. In the data, original and predicted values are different, but when I extract the means, these are the same.
Using margins has the same problem (as only fixed effects are incorporated)
margins i.time#i.intervention
I am wondering what is wrong and how I could calculate predictive means that incorporate both fixed and random effects in order to produce a graph.
Thanks in advance for your time
Reference:
Twisk J, Bosman L, Hoekstra T, Rijnhart J, Welten M, Heymans M. Different ways to estimate treatment effects in randomised controlled trials. Contemporary clinical trials communications 2018; 10: 80-5.
0 Response to Predicting values which incorporate fixed and random effects in linear mixed model
Post a Comment