On this thread here we figured out how to export a covariance matrix to Excel using -putexcel- : https://www.statalist.org/forums/for...atrix-to-excel
However I like using Ben Jann's -esttab- for its superior formatting abilities.
Unfortunately it seems that it is not possible to export a covariance matrix using -esttab-.
Ben Jann might consider extending his command -estpost correlate- to accommodate the export of covariance matrices.
So when I export correlation matrix, everything works fine:
But when I try to export my covariance matrix, computer says no:
Reading the help file of -estpost correlate- indeed it turns out that the option cov is not allowed. But then how do we export covariance matrices?
However I like using Ben Jann's -esttab- for its superior formatting abilities.
Unfortunately it seems that it is not possible to export a covariance matrix using -esttab-.
Ben Jann might consider extending his command -estpost correlate- to accommodate the export of covariance matrices.
So when I export correlation matrix, everything works fine:
Code:
. sysuse auto, clear (1978 Automobile Data) . correlate price mpg headroom (obs=74) | price mpg headroom -------------+--------------------------- price | 1.0000 mpg | -0.4686 1.0000 headroom | 0.1145 -0.4138 1.0000 . qui estpost correlate price mpg headroom, matrix . eststo correlations . esttab correlations using TEMPcorrelations.csv, unstack compress b(2) (output written to TEMPcorrelations.csv)
Code:
. correlate price mpg headroom, cov (obs=74) | price mpg headroom -------------+--------------------------- price | 8.7e+06 mpg | -7996.28 33.472 headroom | 285.721 -2.02536 .715707 . qui estpost correlate price mpg headroom, matrix cov option cov not allowed r(198);
Comment