Announcement

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

  • Repeated Measures Correlation Question

    Hello all!

    Beginner stats student here. I was hoping to gain some insight from the board in how to approach my dataset. I would like to assess the correlation (or lack thereof) between dose of opioid administered and respective pain score (Score 1-10) for multiple entries.

    id time tr y
    1 1 3.5 4
    1 2 7.0 2
    1 3 4.0 5
    2 1 3.0 6
    2 2 6.0 2
    2 3 4.0 4
    3 1 2.0 8
    3 2 3.0 6
    3 3 6.0 1

    I figured a repeated measure anova would be appropriate to assess between-subject and within-subject effects however, my inter-patient effect for tr (mg dose) is not uniform. Am I overthinking this or is there another approach?

    Thanks!

  • #2
    You need a mixed effect model with time X tr interactation. See -help mixed- for proper understanding of the model. Use post-model command 'margins' to explore the dose and time related change in 'y' (see -help margins-). Using your data above a brief purely mechanistic example is given below :

    Code:
    input id time tr y
    1 1 3.5 4
    1 2 7.0 2
    1 3 4.0 5
    2 1 3.0 6
    2 2 6.0 2
    2 3 4.0 4
    3 1 2.0 8
    3 2 3.0 6
    3 3 6.0 1
    end
    
    xtset id time //declare dataset to be repeated time
    
    mixed y i.time##c.tr ||id: //run the mixed effect model with random intercepts
    
    //model output:
    
    Performing EM optimization:
    
    Performing gradient-based optimization:
    
    Iteration 0:   log likelihood = -4.4678507  
    Iteration 1:   log likelihood = -4.4006586  
    Iteration 2:   log likelihood = -4.4005921  
    Iteration 3:   log likelihood = -4.4005921  
    
    Computing standard errors:
    
    Mixed-effects ML regression                     Number of obs     =          9
    Group variable: id                              Number of groups  =          3
    
                                                    Obs per group:
                                                                  min =          3
                                                                  avg =        3.0
                                                                  max =          3
    
                                                    Wald chi2(5)      =     257.93
    Log likelihood = -4.4005921                     Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
               y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            time |
              2  |  -4.208791   1.298437    -3.24   0.001     -6.75368   -1.663902
              3  |  -1.785714   1.564085    -1.14   0.254    -4.851265    1.279837
                 |
              tr |  -2.571429   .3652917    -7.04   0.000    -3.287387    -1.85547
                 |
       time#c.tr |
              2  |   1.494505   .3891026     3.84   0.000     .7318785    2.257132
              3  |   .8214286   .4379693     1.88   0.061    -.0369755    1.679833
                 |
           _cons |   13.28571   1.059766    12.54   0.000     11.20861    15.36282
    ------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    id: Identity                 |
                      var(_cons) |   1.35e-22   3.89e-21      4.28e-47    426.1588
    -----------------------------+------------------------------------------------
                   var(Residual) |   .1556777   .0733886      .0617957     .392188
    ------------------------------------------------------------------------------
    LR test vs. linear model: chibar2(01) = 0.00          Prob >= chibar2 = 1.0000
    
    
    //Use of post-model command margins to explore the relationship
    
    margins time, at(tr=(2/6))
    marginsplot,



    Attached Files
    Roman

    Comment

    Working...
    X