Announcement

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

  • pwcorr with three level of sig.

    Hello, I have a problem showing the three level of significance level for correlation test. Could you please help me with the command to show correlation table output with *, **, *** (0.01, 0.05, and 0.10) in one run please.

    I understand that I can do it for one level of significance, for example ..
    pwcorr VariableA VariableB, sig star (.05) but I need all level of significance to be shown, i.e. I need correlation matrix table shows *, **, and *** Thank you

  • #2
    Try asdoc:

    For the first time, it'd need an installation:
    Code:
    ssc install asdoc
    Then add pwcorr to that:
    Code:
    asdoc pwcorr VariableA VariableB, star(all)

    Comment


    • #3
      Thank you so much..

      Comment


      • #4
        Commands to produce correlation matrices have been in Stata for a long time, and they seem to remain a popular display. I often wonder how far that is tribal ritual, although the attitude of "Here is a table of correlations if you want it" isn't especially harmful. Sometimes, one does want to look up some particular correlation of interest.

        Starring according to P-value thresholds is again sometimes tribal ritual and much has been said about it, and particularly against it. The attitude of "Sure, the correlation looks small, but don't knock it: it is significant!" again meets different attitudes. There are fields in which quantifying or establishing small effects that are detectable in large samples is much of the game.


        As personal rules of thumb:

        1. If uncertainty is the issue, and when isn't it?, I would usually rather see confidence intervals than P-values.

        2. Even when a P-value is of interest, it's the P-value itself you should notice, and above all the magnitude of the associated correlation. Starring just degrades a measurement, albeit often a problematic measurement.

        3. For a few correlations, a table is efficient. For even 10 or so, a graph can be more effective. For 100 or so, a matrix display might have a dictionary or directory flavour: I might use it to look up an item, but scanning the whole to see patterns is neither efficient nor effective.


        This token alternative takes

        corrci from the Stata Journal, which you need to install before you can use it. The crucial detail here is being able to save correlations and other results to a separate dataset.

        labmask from the Stata Journal, ditto.

        Otherwise the application is justone of graph twoway. The code here understates the amount of fiddling around that may be needed to add or change options.


        Code:
        sysuse auto, clear
        corrci headroom trunk weight length displacement, saving(corrci_results, replace)
        use corrci_results
        sort r
        gen order = _n
        egen which = concat(var*), p(" ")
        labmask order, values(which)
        gen toshow = strofreal(r, "%4.3f")
        
        set scheme s1color 
        
        scatter order r, yla(1/10, valuelabel noticks ang(h)) mla(toshow) mlabpos(12) || rcap lower upper order, horizontal ytitle("") xtitle(correlation) legend(off) xsc(alt r(0 .)) ysc(r(. 10.5)) xla(0 "0" 1 "1" 0.2(0.2)0.8, format(%02.1f)) xli(0, lc(gs8))
        Click image for larger version

Name:	corrci.png
Views:	1
Size:	34.4 KB
ID:	1666516


        Some small details may deserve a flag:

        1. Sorting on correlations can be helpful.

        2. For a graph with table flavour, putting the x axis at the top is a twist I like.

        3. Marker labels can be used to satisfy the primal craving to see the numbers!

        4. A reference line at correlation 0 can be helpful if being not zero is an issue. A reference line at correlation 1 is clearly possible in the same sort of way.

        When might a display like this be worth a try? Not for 1 correlation or 3, or for 100 or more, but just possibly for up to about 30 correlations.

        Nothing here is meant to undermine a standard point that often you should be looking at a scatter plot matrix as well.

        Comment

        Working...
        X