Announcement

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

  • Get group effect over time at a specific level of a covariable and overall in mixed effects linear regression

    Dear all

    Two groups consisting each of multiple patients (pid) were tested on an ergometer on different performance scales over time. The continuous outcome was recorded over time.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(pid group performance) double outcome
    1 1 200  30
    1 1 200  82
    1 1 200 128
    1 1 200  68
    1 1 200 132
    1 1 200 158
    1 1 200 157
    1 1 200 122
    1 1 200 168
    1 1 200 173
    end
    label values group group
    label def group 1 "Group 1" 0 "Group 2", modify
    I ran a mixed effects linear regression to incorporate the repeated measurement nature of the data and allowed the outcome to vary as a restricted cubic spline over time at each performance level.

    This is my Stata code (Stata MP version 18.0):
    Code:
    mkspline timespl = time, cubic
    mixed outcome i.group##c.timespl* i.performance  || pid: timespl*
    
    margins i.group, over(time)
    marginsplot, xdim(time) recast(line)  recastci(rarea) ciopt(color(%30)) legend(position(6) col(2))



    Click image for larger version

Name:	marginsplot.jpeg
Views:	1
Size:	487.7 KB
ID:	1770874

    I now like to answer the following questions:
    1.) Is there an overall significant difference of the two curves, i.e. a group effect over time regarding the outcome?
    2.) If there is a group effect over time: Are the curves different at the first performance level already, or at the second, or third, ...

    How can I test this in Stata (margin command with dydx and at option? lincom command? test command?)? I am not sure.
    Thank you for your help in advance.

    Martin
Working...
X