Suppose we have a longitudinal dataset with variables ID, y (outcome), x (primary predictor), time and some covariates. Each ID was measured at 4 time points. I want to use the "mixed" command to generate linear mixed effects models.
For random intercepts model, my command is:
mixed y covariates i.time || ID:
est store ri
For random slopes model, my command is:
mixed y x covariates i.time || ID:
est store rs
For mixed effects model, my command is:
mixed y x covariates i.time || ID: x, cov(unstructured)
est store me
Questions:
1. For the mixed effects model, how do I determine which covariance structure to use?
2. If I get p > 0.05 from lrtest me rs, does this mean random slopes model is preferred over mixed effects model?
Please let me know if there is anything that needs clarification or correction. I'll make sure to reply as soon as possible. Thank you for your help and insight!
For random intercepts model, my command is:
mixed y covariates i.time || ID:
est store ri
For random slopes model, my command is:
mixed y x covariates i.time || ID:
est store rs
For mixed effects model, my command is:
mixed y x covariates i.time || ID: x, cov(unstructured)
est store me
Questions:
1. For the mixed effects model, how do I determine which covariance structure to use?
2. If I get p > 0.05 from lrtest me rs, does this mean random slopes model is preferred over mixed effects model?
Please let me know if there is anything that needs clarification or correction. I'll make sure to reply as soon as possible. Thank you for your help and insight!

Comment