Announcement

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

  • Calculating correlation from covariance in multilevel model

    To answer my research question, I need to determine whether the random intercepts affect the random slopes. Unfortunately, the estimated covariance is rather small, which I suspect may be due to characteristics of my independent variable. Therefore, I would like to calculate the correlation between them manually.

    I couldn’t find a specific option to directly display the correlation in my model code (mixed dep.var. ind.var. c.age##c.age || cid: randomslope, mle var cov(uns)). However, as I understand it, the correlation can be computed using this formula:

    covariance/ √((varintercept) * var(slope)

    Based on the random-effects output:


    Random-effects parameters | Estimate Std. err. [95% conf. interval]
    -----------------------------+------------------------------------------------
    cid: Unstructured |
    var(z_opcha_pc) | .0213654 .0082598 .0100147 .045581
    var(_cons) | .2529837 .0856323 .1303076 .4911511
    cov(z_opcha_pc,_cons) | .0478774 .021923 .0049092 .0908456
    -----------------------------+------------------------------------------------
    var(Residual) | 4.558039 .039193 4.481866 4.635507

    The resulting correlation should be: 0.04788/√(0.02137*0.25298) = 0.6514.


    This value aligns surprisingly well with my hypothesis, which makes me wonder whether I might be overlooking something. I’d appreciate any input or critical feedback and thank you very much for your time and support!

  • #2
    Originally posted by Philipp Weimer View Post
    . . . I would like to calculate the correlation between them . . .

    I couldn’t find a specific option to directly display the correlation in my model code (mixed dep.var. ind.var. c.age##c.age || cid: randomslope, mle var cov(uns)).
    Try the postestimation command
    Code:
    estat sd
    Its help file is here.

    Comment


    • #3
      I think that you can also get the same information by using the stddeviations option instead of the (default) variance option that you specified.

      Comment


      • #4
        Originally posted by Joseph Coveney View Post
        I think that you can also get the same information by using the stddeviations option instead of the (default) variance option that you specified.
        Oh, thank you so much! That worked. I don’t know how I could have overlooked it. Sometimes the solution is just too close to see. You've been a great help!

        Comment

        Working...
        X