Announcement

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

  • mixed linear regression graph

    Hi,
    I am doing a mixed model with two fixed factors (Age and PUFA_g), one random factor (Visit), and dependent variable is (FMD_change) using the following code:
    mixed FMD_change Age PUFA_g || Visit:
    How can I produce a graph showing the line of the predicted FMD_change in regards to the fixed and random effects?

    Thank you,
    Aseel

  • #2
    Age and PUFA_g have been modeled as continuous variables. So you need to pick out values of these variables that more or less span the range of commonly observed values and then use the -margins- and -marginsplot- commands. So, to illustrate the approach with Age, and assuming that your data are a sample of mid-life adults, we might pick 35 40 45 50 55 and 60 as a suitable set of values of Age to use in the graph. Then following the -mixed- command:
    Code:
    margins, at(Age =(35 40 45 50 55 60))
    marginsplot
    That said, Visit sounds like a very strange choice for a random effect and I'm wondering what that's about.

    Comment


    • #3
      Thank you very much Clyde!
      Regarding "visit", it is a synonym to "meal type", as the subjects consumed two different types of meals so I named it as "visit 1"and "visit 2" but I named it as visit instead of meal to capture the other differences that happens in each visit beside the type of meal.

      Comment


      • #4
        Regarding "visit", it is a synonym to "meal type", as the subjects consumed two different types of meals so I named it as "visit 1"and "visit 2" but I named it as visit instead of meal to capture the other differences that happens in each visit beside the type of meal.
        I would not use this as a random effect. I would include it as a fixed effect in the model. First of all, it is unlikely that these two different types of meals are to be viewed as a sample from some larger population of meals. Second of all, even if the two meals were, in fact, randomly sampled from some larger universe of meals, a sample with an N of 2 is not adequate to produce a useful estimate of variation at that level.

        What I suspect you really need is a random effect at the subject level. If I understand you correctly, each subject consumed both types of meals (on separate occasions). The number of subjects, I would hope and believe, is much larger than two. Appropriate modeling for that would include subject as a random effect, but meal as a simple dichotomous variable, used as a fixed effect in the model.

        Comment


        • #5


          What I suspect you really need is a random effect at the subject level. If I understand you correctly, each subject consumed both types of meals (on separate occasions). The number of subjects, I would hope and believe, is much larger than two. Appropriate modeling for that would include subject as a random effect, but meal as a simple dichotomous variable, used as a fixed effect in the model.[/QUOTE]

          Correct.

          Thank you for all the explanation. It is very helpful.

          Comment

          Working...
          X