Announcement

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

  • Linear mixed models: random effects for both intercept and slope? lincom margins for continuous predictors

    Hi,

    I am a student, starting to deal with linear mixed models in STATA and your help would be extremely valuable.



    1. I wonder whether or not I need to add a random slope in addition to the random intercept in linear mixed models. I am studying the impact of hypertension on cognition over time.

    xtmixed outcome predictor covariates time || id: time OR xtmixed outcome predictor covariates time || id:

    Using the model with the lowest AIC is a good option? Do I need to systematically add a random slope when I work on repeated data over time with linear mixed models?



    2. I wanted to confirm is my interpretation is correct for the following outputs:

    Code:
     xtmixed cognition blood_pressure year || id : year
    blood_pressure: coeff = -0.18 et p=0.24
    year: coeff = -0.47 et p<0.001
    _cons: 90.78

    In this case, I understand that whatever the time during follow-up, a subject with 1 mmHg increase in blood pressure will have -0.18 of cognition. I also understand that for each additional year, a subject will have -0.47 points of cognition. And the difference of cognition between a subject with 130 mmHg of blood pressure and 140 mmHg will stay the same all the time = 1.8 point

    Code:
     xtmixed c.cognition blood_pressure##c.year || id : year
    blood_pressure: coeff = -0.32 et p=0.04
    year: coeff = -0.47 et p<0.001
    c.blood_pressure#c.year: coeff = 0.10 et p<0.001
    _cons : 90.78

    In this case, I understand that for each additional mmHg of blood pressure, cognition will be lower (-0.32). For each additional year, also lower (-0.47). But the impact of hypertension on cognition is not the same during the follow-up. I'm not able to calculate the difference of cognition between a patient with 130 and another one with 140 mmHg of blood pressure at year 2 for example and the same thing at year 4.

    How can I compute those differences with STATA?

    Lincom, margins?

    Thank you very much for your help. I'm a medical student trying to deal with linear mixed models for the first time without help

  • #2
    1) It depends on whether or not you are interested in the extent of variation among id's in the slope of the outcome-predictor relationship. If you omit the random slope, Stata will give you the average slope in the "fixed effects" output. If you add a random slope as well, you will get the same average slope in the fixed effects output and in the random effects output you will get an estimate of the variance or standard deviation of the individual slopes. If you care about the latter, then include a random slope. If that is of no importance to your research it is just a waste of time to calculate it.

    Random slopes are sometimes called "cross-level interactions" because they are indeed equivalent to having an interaction between the id variable and the predictor term. So it is really just the same as with any other interaction term: if you believe there is this kind of additional variation and it is something you need to account for in your research, then you include the interaction. Otherwise you don't.

    I do not generally recommend selecting variables to include in models based on statistical tests, AIC or others. It is better to make these choices a priori based on your understanding of the real world process you are modeling and your research goals.

    2) The syntax you show does not correspond to a sensible model. By including blood pressure in your interaction without a c.prefix, Stata will interpret this as calling for blood pressure to be treated as a discrete variable. That doesn't make any sense. Your syntax should be:

    Code:
    mixed cognition c.blood_pressure##c.year || id:
    Note: Since Stata 13 the name -xtmixed- has been changed to -mixed-.

    After that change in syntax, your language is a bit too close to sounding causal, but it is otherwise essentially correct. I would say it more like this:

    The expected difference in cognition associated with a 1 mmHg difference in blood pressure is a decrease of 0.32 units. This is true in this model without regard to year.

    3) This is not correct. The correct interpretation would be:

    The expected difference in cognition associated with a 1 mmHg difference in blood pressure is a decrease of 0.32 units when the year is 0. The expected difference in cognition associated with a 1 year difference in year is -0.47 when the blood pressure is 0.

    Now, unless your variables year and blood pressure are centered around observed values, my guess is that the above interpretation is pretty useless because blood pressure is not 0 in living people, and year is not 0 among people currently alive either (unless year means age and we are dealing with infants.) So I would not bother interpreting those coefficients as they stand. Rather, I would provide examples of these effects at realistic values of blood pressure and year.

    Let's say that interesting values of blood pressure (I'll assume we're dealing with systolic blood pressure here) are 100, 120, 140, 160, and 180, and that interesting values of year are 65, 70, 75, 80, 85). Then:

    Code:
    mixed cognition c.blood_pressure##c.year || id:
    margins, dydx(*) at(blood_pressure = (100(20)180) year = (65(5)85))
    That will give you the effects of blood pressure and year at all combinations of those values.

    Comment

    Working...
    X