Announcement

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

  • creating matrix of coefficient covariance values

    hi-- I would like to create matrices of the coefficient covariance matrices generated by the code:
    Code:
    estat vce
    I need to use these matrices in a standard error calculation, so they need to be in a usable matrix format that allows me to do matrix multiplication etc.
    I have tried using:
    Code:
    matrix covmat = get(vce)
    but this has not worked.

    thank you

  • #2
    Code:
    estat vce
    matrix covmat = r(V)

    Comment


    • #3
      thank you. from here, how can I export this matrix into a csv?

      Comment


      • #4
        -help export delimited- Before that, you need to clear the data in memory and -svmat covmat-.
        Last edited by Clyde Schechter; 09 Dec 2022, 10:35.

        Comment


        • #5
          Rebecca Sansale , you can use -putexcel- to export to a spreadsheet.

          E.g.,

          Code:
          . sysuse auto, clear
          (1978 automobile data)
          
          . qui reg price mpg headroom trunk weight
          
          . estat vce
          
          Covariance matrix of coefficients of regress model
          
                  e(V) |        mpg    headroom       trunk      weight       _cons 
          -------------+------------------------------------------------------------
                   mpg |  7381.6192                                                 
              headroom | -36.876752   213473.73                                     
                 trunk |  714.81065  -25963.776   11742.956                         
                weight |   41.72874  -16.507684  -25.485482   .49511376             
                 _cons | -292929.87  -231171.78  -22100.242  -1983.6762    13308485 
          
          . matlist r(V)
          
                       |       mpg   headroom      trunk     weight      _cons 
          -------------+-------------------------------------------------------
                   mpg |  7381.619                                             
              headroom | -36.87675   213473.7                                  
                 trunk |  714.8106  -25963.78   11742.96                       
                weight |  41.72874  -16.50768  -25.48548   .4951138            
                 _cons | -292929.9  -231171.8  -22100.24  -1983.676   1.33e+07 
          
          . putexcel set results
          
          . putexcel A1 = rmatrices
          file results.xlsx saved
          
          .

          Comment


          • #6
            Also Rebecca Sansale you have the best avatar picture that I have ever seen around here on Statalist. There is nothing more heavy-metal than sitting on a throne and raising a cup to cheer the mortals :P. As soon as I find a properly looking throne, I will make an avatar picture for myself following your design !

            Comment

            Working...
            X