Hi!
I am a phd student currently analyzing the relationship between road traffic noise exposure and bmi in children. Both noise and bmi are measured at several different time points. I want to include noise as a time-varying covariate in a linear mixed model analysis, but I am not completely sure how to do this. Here, some syntax example and questions follow, and I would really appreaciate your thoughts on these:
*Start by splitting the noise variable into between persons and within persons effects:
*Between persons:
*Generate a variable corresponding to each persons mean score on the noise variable:
egen noise_personmean = mean(noise), by(id)
*Center this variable by subtracting the sample mean to get a meaningful 0:
egen noise_samplemean = mean(noise)
gen noise_bp = noise_personmean - noise_samplemean /*This variable now represents the between persons effect, the person mean of noise values*/
*Next, I create a variable that represents the within person effect (each noise score's difference from the person's mean noise value):
gen noise_wp = noise - noise_personmean
*Then, the bp and wp effects of noise are included in the model:
mixed bmi noise_wp noise_bp age i.gender || id: age, cov(unstructured) mle
*A significant noise_bp indicates the main effect of noise on bmi when for having been exposed to a higher average noise Level than others. The noise_wp indicates the main effect of being exposed to higher noise level than you are exposed to on average.
/*Questions:
1) Does the above syntax seem like an OK way of analyzing time-varying covariates in linear mixed models?
2) Should noise_wp be included as a random effect?
2) Is the analysis enough to answer the question of whether noise is related to bmi over time, or should I in addition include interactions between age and noise_bp and age and noise_wp etc..? I.e.:
mixed bmi noise_wp noise_bp c.noise_wp#c.noise_bp age c.age#c.noise_wp c.age#c.noise_bp i.gender || id: age, cov(unstructured) mle
3) What additional steps should I consider in the analysis?
*/
Best,
Kjell V. Weyde, phd student
I am a phd student currently analyzing the relationship between road traffic noise exposure and bmi in children. Both noise and bmi are measured at several different time points. I want to include noise as a time-varying covariate in a linear mixed model analysis, but I am not completely sure how to do this. Here, some syntax example and questions follow, and I would really appreaciate your thoughts on these:
*Start by splitting the noise variable into between persons and within persons effects:
*Between persons:
*Generate a variable corresponding to each persons mean score on the noise variable:
egen noise_personmean = mean(noise), by(id)
*Center this variable by subtracting the sample mean to get a meaningful 0:
egen noise_samplemean = mean(noise)
gen noise_bp = noise_personmean - noise_samplemean /*This variable now represents the between persons effect, the person mean of noise values*/
*Next, I create a variable that represents the within person effect (each noise score's difference from the person's mean noise value):
gen noise_wp = noise - noise_personmean
*Then, the bp and wp effects of noise are included in the model:
mixed bmi noise_wp noise_bp age i.gender || id: age, cov(unstructured) mle
*A significant noise_bp indicates the main effect of noise on bmi when for having been exposed to a higher average noise Level than others. The noise_wp indicates the main effect of being exposed to higher noise level than you are exposed to on average.
/*Questions:
1) Does the above syntax seem like an OK way of analyzing time-varying covariates in linear mixed models?
2) Should noise_wp be included as a random effect?
2) Is the analysis enough to answer the question of whether noise is related to bmi over time, or should I in addition include interactions between age and noise_bp and age and noise_wp etc..? I.e.:
mixed bmi noise_wp noise_bp c.noise_wp#c.noise_bp age c.age#c.noise_wp c.age#c.noise_bp i.gender || id: age, cov(unstructured) mle
3) What additional steps should I consider in the analysis?
*/
Best,
Kjell V. Weyde, phd student
Comment