Announcement

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

  • Correlation matix output in sureg

    Hi all,

    I'm using sureg command to do analysis.

    I want to export the correlation matrix in the end of the table to excel . Does anyone know how to do this?

    Click image for larger version

Name:	corr.PNG
Views:	1
Size:	117.1 KB
ID:	1668438


    Thanks a lot in advance!


  • #2
    Melody, -sureg- saves the covariance matrix of residuals in e(Sigma). You may transform it into correlation matrix first and then export to Excel using -putexcel-. Note that the excel file will be created in your working directory.

    Code:
    sysuse auto, clear
    sureg (price foreign mpg displ) (weight foreign length), corr
    
    mat corr = corr(e(Sigma))
    
    putexcel set corr.xlsx, sheet("corr") replace
    putexcel A1 = matrix(corr), names

    Comment


    • #3
      Originally posted by Fei Wang View Post
      Melody, -sureg- saves the covariance matrix of residuals in e(Sigma). You may transform it into correlation matrix first and then export to Excel using -putexcel-. Note that the excel file will be created in your working directory.

      Code:
      sysuse auto, clear
      sureg (price foreign mpg displ) (weight foreign length), corr
      
      mat corr = corr(e(Sigma))
      
      putexcel set corr.xlsx, sheet("corr") replace
      putexcel A1 = matrix(corr), names
      Hi Fei,

      Thanks a lot for the code. It works well for me

      Comment


      • #4
        Hi dear STATA users,

        I want to analyze a SUR model in 30 years with 10 countries 1 dependent variable and 5 independent variables in STATA (dep1 var1 var2 var3 var4 var5).
        But I could not create the correlation matrix between countries (I mean correlatin between panel ID) .
        How can I culculate Correlation Matrix ?
        Can anyone help me with this?
        Thank you for your help.

        Comment

        Working...
        X