Announcement

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

  • Export Spearman Correlations with Significance Level

    Hello,

    I am trying to export Spearman correlations in a matrix with significance level below the correlation coefficient, but I am stuck. Any suggestions? Here is my code so far:
    Code:
    sysuse auto, clear
    
    spearman price mpg weight, pw stats(rho p)
    matrix A = r(Rho)
    
    esttab matrix(A, fmt(%5.2f)) using corrtable.rtf
    Last edited by Kelly Anderson; 20 Jul 2023, 09:54.

  • #2
    Code:
    sysuse auto, clear
    
    spearman price mpg weight, pw stats(rho p)
    matrix A = r(Rho)
    matrix P = r(P)
    
    local c = colsof(A)
    
    forvalues i = 1/`c' {
        matrix M = nullmat(M) \ A[`i', 1..`c']
        matrix M = M \ P[`i', 1..`c']
    }
    
    matrix list M
    You can then -esttab- matrix M.

    Comment


    • #3
      Also see #3 of https://www.statalist.org/forums/for...ort-into-excel. Note that estout is from SSC (FAQ Advice #12).

      Comment

      Working...
      X