Announcement

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

  • Heatplot graph by

    Hi,
    I am trying to graph a correlation matrix. Im using "heatplot" command and it's fine. But when I try to add the "by" command it gives me an error. this is my code: heatplot corrmatrix , values(format(%4.3f) size(small)) legend(off) color(lch,diverging) by(sex,total) before this is the correlation : pwcorr Nvariables and then i am name the matrix ; matrix corrmatrix = r(C) is there another way to graph a correlation matrix by a variable?

  • #2
    Data example please, using the dataex command. Also please include your code in code delimiters. If nobody's told you yet, welcome to Statalist.

    Comment


    • #3
      heatplot (from SSC, as you are asked to explain) is a great command I've only used occasionally, but it's clear that what you want can't be done that way.

      First off, the help explains that by() as an option isn't supported if you use the syntax of feeding a correlation matrix to heatplot.

      Second, the syntax

      Code:
      pwcorr Nvariables
      presumably isn't what you typed but given a variable list rather than a single variable pwcorr produces a single correlation matrix for all the data specified.

      You have perhaps three correlation matrices you want to see, for males, for females and for everyone. That could only be obtained by running pwcorr repeatedly and getting a heatplot after each run. Then you could use graph combine to look at all three together. I am not clear how effective that is going to be, but that's a different matter.

      Comment

      Working...
      X