Announcement

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

  • Heatplot for Spearman correlation

    Hello all,
    I am running some correlations and plotting a heatmap matrix, but I would like to know how can I add a star for significance level (<5%). I did not find something helpful. The command I am using is the following:

    spearman var1 var2 var3 var4, stats(rho p) star(.05), if var5==1
    matrix C = r(Rho)
    heatplot C, legend(on) color(hcl diverging, intensity(.6)) keylabels(, format(%4.2f)) lower

    Is there any addicional command to add a star to the significant correlations in my plot? Can someone help me in this regard?
    Thanks in advance!

  • #2
    heatplot is from SSC (FAQ Advice #12). See https://www.statalist.org/forums/for...about-heatplot

    Comment


    • #3
      The solution I found was to add asterisc (*) in the edit graph option.

      But generating the plots I run into another problem, it seems the gradient colours are not matching the significant values. For example, the white color still gives me a significative value for the Spearman correlation as seen in this picture:

      Click image for larger version

Name:	Captura de tela 2023-05-23 211304.png
Views:	1
Size:	19.2 KB
ID:	1714651


      I am not sure if I was clear. Please, help me!

      Comment


      • #4
        You are starring based on the coefficients and not the p-values, which is not what you intend. I already referred you to the link in #2 and I see no evidence that you followed the procedure outlined there.

        Comment


        • #5
          Originally posted by Andrew Musau View Post
          You are starring based on the coefficients and not the p-values, which is not what you intend. I already referred you to the link in #2 and I see no evidence that you followed the procedure outlined there.
          The star was added based on the p values generated from the spearman test. But what I don't understand is how my colours don't match the correlations. The white was supposed to be the coefficient closest to zero, but that is not working here. I would like to fix this cause I need to generate this graphs as soon as possible for my qualification exam :/

          Comment


          • #6
            As recommended in FAQ Advice #12, you need to create a reproducible example to increase your chances of getting helpful replies. Otherwise, I have offered all the help that I can with no data example.

            Comment

            Working...
            X