Announcement

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

  • Heatplot using Spearman's correlation

    Hello,

    I am trying to generate a heatplot using Speaman's correlation matrix but without success. I was wondering if anyone else has come across this before and have any ideas?

    This code works for Pearsons correlation, but my data are not normally distributed so would like to redo this with spearman.

    Code:
    correlate ei eqhwbscore EQindex eqvas huiscore sf6d icecaptariff
    matrix C = r(C)
    heatplot C, values(format(%9.2f)) color(hcl diverging, intensity(.6)) legend(on) aspectratio(0.9) lower label  cut(0(0.2)1)

    But when I try to run a spearman's correlation - I get an error message "variable __00000O not found":
    Code:
    spearman ei eqhwbscore EQindex eqvas huiscore sf6d icecaptariff
    matrix C = r(C)
    heatplot C, values(format(%9.2f)) color(hcl diverging, intensity(.6)) legend(on) aspectratio(0.9) lower label  cut(0(0.2)1)
    Any ideas greatly appreciated!
    Tara
    Last edited by Tara Wick; 21 Feb 2023, 07:13.

  • #2
    spearman leaves a correlation matrix in r(rho) not r(C) : see its help or return list after running the command.

    It's not illegal to refer to an undefined r-class result, but the result will usually be missing.

    Comment


    • #3
      Thank you so much - that did the trick!

      Comment

      Working...
      X