There was no pid variable in the example you posted, so I can't really work with it in a mixed model. Also, all of the observations you showed were controls. I'll need those things fixed in order to work on it. I also note that you have some negative ages in the data: that won't matter for the purposes of my experimenting with code, but if that's in your real data, you need to look into that.
As for your question 1., b) is correct, not a).
As for how to handle the predicted difference of the bmi after 24 months, the approach is this. You will have 3 time spline variables, timespl1, timespl2, and timespl3. Then you would do something like this:
As for 2), it's not good, but probably not fatal. One possibility relates to the way you have constructed the cubic splines. Having knots at the endpoints of the data range is not very helpful. You might want to consider using knots(6 12 24), or something like that. Or perhaps just specify nknots(4) and let Stata locate them for you.
As for your question 1., b) is correct, not a).
As for how to handle the predicted difference of the bmi after 24 months, the approach is this. You will have 3 time spline variables, timespl1, timespl2, and timespl3. Then you would do something like this:
Code:
forvalues i = 1/3 { summ timespl`i' if time == 24, meanonly local sp24_`i' = r(mean) } lincom `sp24_1'*_b[1.case#timespl1] + `sp24_2'*_b[1.case#timespl2] + `sp24_3'*_b[1.case#timespl3]
Comment