Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Modelling time-varying covariates in linear mixed models

    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


  • #2
    1) Does the above syntax seem like an OK way of analyzing time-varying covariates in linear mixed models?

    The syntax looks fine. Your approach, looking at both within-person and between-person effects is rather fine-grained--which is commendable.

    The rest of your questions are really not about statistics or Stata, they are about scientific issues in the design of your study. For example, including a random slope for noise_wp would be modeling the slope of the bmi-noise_wp relationship to vary among persons. Omitting it says that there is a single slope that characterizes the linear bmi-noise_wp relationship for all people. Which of these models is better is a scientific, not a statistical issue. It could even be the goal of a study in its own right: to fit both models and determine whether a "one size fits all" model is as good a desscription of the data as a model with individually varying slopes. Similarly, whether to include interactions between age and the noise variables is a scientific question: do the noise-bmi relationships vary with age, or does a single age-independent relationship adequately characterize things. And, again, this could be the subject of a research paper in its own right.

    So, I don't think this is the right place to get advice on those questions. Consult your colleagues who have expertise on the relationship between noise and bmi, or perhaps there is an on-line forum out there for people who are knowledgeable and interested in that topic.

    Comment


    • #3
      Thank you for your comments!
      My main goal is to say something about whether the Association between bmi and age depends on noise exposure. Therefore, interaction terms between age and the two noise components are added to the model (and perhaps between noise and age2 as well) In addition, since the effect of having a higher value than usual on the noise variable at a given time may differ by your average noise exposure, an interaction term between noise_wp and noise_bp is also included. Gender#noise_wp and gender#noise_bp are also included. Further, noise_wp is included as a random effect. This gives the following model:

      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 i.gender#c.noise_wp i.gender#c.noise_bp || id: age noise_wp, cov(unstructured) mle

      To answer my question, does the association between bmi and age depend on noise, is it sufficient to look at the c.age#c.noise_wp-term? And if signifiacant, use margins and marginsplot to explore the effects of noise further? Or maybe do several cross-sectional analyses, i.e. "normal" linear regressions for each age point?

      And should I check for contextual effects in the model? Or does it look good enough to answer my research question?


      Kjell Weyde

      Comment


      • #4
        To answer my question, does the association between bmi and age depend on noise, is it sufficient to look at the c.age#c.noise_wp-term? And if signifiacant, use margins and marginsplot to explore the effects of noise further?

        Yes. I don't see the need for doing age-specific cross-sectional regressions. In fact, I think they would be a bad idea. The data for any single age level will be noisier than the data set as a whole. An advantage of multi-level models is that this noise gets smoothed out across the data set.


        And should I check for contextual effects in the model?
        I don't know what kind of contextual effects you have in mind, nor how you might look for them.

        Comment


        • #5
          Hello Kjell Weyde,

          Was the coding you gave in your initial inquiry sufficient to answer your question number 1? I am also a phd student trying to figure out how to incorporate time-varying covariates in a mixed model. Unfortunately, some are binary, becoming 0 or 1 from year to year when relevant. For instance, if someone starts and stops smoking across follow-up. But I believe the way you did it would still work well.

          Thank you,
          Spencer Keene

          Comment

          Working...
          X