Announcement

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

  • xtreg results or margins to show correlation coefficent with each level of interacted factor

    i'm trying to model the linear relation in a panek of continuous indep var X on continuous dep var Y, across intervals of another variable Z collapsed into categorical bins Zcat. my data are xtset with i (1-400) and t(1-48) with about 5% missings, using xtreg random model..
    i have:
    Code:
    xtreg Y c.X ## i.Zcat
    margins i.Zcat, dydx(X)
    this shows me the slope within each level of Zcat as , along with se, ci, z and p.
    what i would like also to see is some indicator like correlation coefficient for the relaitonship within each level. using "margins, post" and "ereturn, list" i could not see anything likely.

    is there a formula to derive a correlatiion-coefficient-like statistic from the stored results, or an expression for the margins command to generate something similar?
    thnak you in advance.
    Last edited by George Hoffman; 07 Oct 2022, 13:29.

  • #2
    It is, indeed, possible to wrestle the results of Zcat-specific Y:X correlations out of what you have. But it is complicated and not worth the trouble. Instead, just run:

    Code:
    by Zcat, sort: corr X Y

    Comment


    • #3
      Clyde - i was concerned about losing some of the panel-weighted influence using that approach - but your guidance suggests that those considerations might be outweighed by the complexity required. i might want to pursue those complexities to address anticipated reviewer concserns or at least to be able to say they didnt make much of a difference (for mild unbalanced data). thx

      Comment

      Working...
      X