Hello Everyone,
I am trying to write code for an interaction between a binary predictors and time-varying covariate within a linear mixed model.
Research question: Whether treatment differently reduces weight according to vitamin D supplementation level
In this panel dataset, each participant visited the clinic a minimum of 10 times, and measurement were taken at each visit.
Treatment has two levels, moderate or intense
Weight change is the dependent variable
Vitamin D supplementation is a time-varying covariate. This is a continuous variable (but can be categorized into four levels if this helps with interpretation of the results)
Here is my code:
Next step:
How to include the interaction term between the binary predictor and the time-varying covariate in the code.
Your help will be much appreciated.
Thank you,
Al Bothwell
I am trying to write code for an interaction between a binary predictors and time-varying covariate within a linear mixed model.
Research question: Whether treatment differently reduces weight according to vitamin D supplementation level
In this panel dataset, each participant visited the clinic a minimum of 10 times, and measurement were taken at each visit.
Treatment has two levels, moderate or intense
Weight change is the dependent variable
Vitamin D supplementation is a time-varying covariate. This is a continuous variable (but can be categorized into four levels if this helps with interpretation of the results)
Here is my code:
HTML Code:
mixed weightch i.treat c.vitamindose c.visits || id: c.visits, covariance (uns) variance reml
How to include the interaction term between the binary predictor and the time-varying covariate in the code.
Your help will be much appreciated.
Thank you,
Al Bothwell

Comment