Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Table of partial correlation coefficients


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: Table of partial correlation coefficients
Date   Fri, 11 Mar 2011 12:26:02 -0500

At 10:38 AM 3/11/2011, Charles Koss wrote:
Richard, thank you for following up. Based on your code, I would like
to summarize the results from pcorr. Let's say I run:

webuse auto
pcorr price  mpg trunk weight length
pcorr mpg price   trunk weight length
pcorr trunk price  mpg  weight length
pcorr weight price  mpg trunk  length
pcorr length price  mpg trunk weight

Then, I would like to make a summary of the results from the previous
5 lines of code. I know I can copy & paste but imagine how easy would
it be to obtain a table resembling the corr command output.

To automate the process further (you also need eststo from SSC, in addition to estadd and esttab):

webuse auto, clear
eststo clear
local vlist price  mpg trunk weight length
foreach dv of varlist `vlist' {
        local xvars: list vlist - dv
        reg `dv' `xvars'
        estadd pcorr
        eststo
}
esttab e*, main(pcorr) not noconstant nostar

The last output is

. esttab e*, main(pcorr) not noconstant nostar

-----------------------------------------------------------------------------
                      (1)          (2)          (3)          (4)          (5)
                    price          mpg        trunk       weight       length
-----------------------------------------------------------------------------
mpg                -0.122                   -0.0240       -0.202       -0.174
trunk              0.0317      -0.0240                   -0.0797        0.363
weight              0.409       -0.202      -0.0797                     0.830
length             -0.292       -0.174        0.363        0.830
price                           -0.122       0.0317        0.409       -0.292
-----------------------------------------------------------------------------
N                      74           74           74           74           74
-----------------------------------------------------------------------------
pcorr coefficients

If you don't like that formatting you can play around with the esttab options. Or, if you were so inclined, you could probably create a matrix with all the coefficients.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index