Announcement

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

  • Integral or area-under-curve for marginsplot

    Dear Statlist community,

    First time posting. I'm using a linear mixed effect model for a project. The model includes an interaction term which allows me to compare the longitudinal changes of laboratory values between two groups. A simplified model looks something like this:
    mixed lab_value i.group i.group#c.time i.groups#c.time#c.time, || ID: (c.time##c.time)

    At postestimation, marginsplot procudes beautiful graphs for the groups. However, I would like to calculate the integral of the curve, or the area-under-curve, for the groups and also test whether they differ significantly.

    Any help on this?

  • #2
    The -margins- command has an undocumented -saving()- option that allows you to save the -margins- output results in a Stata data file. When you inspect that file, you will find that its variable names are not convenient to work with, but it will be clear how to rename (some of) them so that the data set clearly contains a groups variable, a time variable, and a corresponding predicted margin. You can then use the -integ- command to calculate area under the curve from that.

    Comment

    Working...
    X