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]
st: RE: RE: RE: -esttab- label and -estpost- Spearman
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: RE: RE: -esttab- label and -estpost- Spearman
Date
Mon, 18 Oct 2010 17:05:14 +0100
Almost but not quite what I had in mind. The -unique- option is not appropriate here. You need the default of -egen, rank()- for precisely the treatment of tied ranks that is appropriate for Spearman correlations.
Nick
[email protected]
Amy Dunbar
Thank you! Worked great. Here's my final code.
egen rETR1 = rank (GAAP_ETR_t), unique
egen rETR2 = rank (CURR_ETR_t), unique
egen rETR3 = rank (CASH_ETR_t), unique
egen rETR4 = rank (LR_CASH_ETR_t), unique
egen rBTD = rank (w_totalBTD), unique
egen rpBTD = rank (w_permBTD), unique
egen rDTAX = rank (w_DTAX), unique
egen raBTD = rank (w_abnBTD), unique
egen rSCOR = rank (w_SHELTER), unique
* correlate gives same results as pwcorr
* The columns of the matrix are stored in separate equations. Hence, use the unstack option in esttab or estout to print the matrix.
estpost correlate GAAP_ETR_t CURR_ETR_t CASH_ETR_t LR_CASH_ETR_t w_totalBTD w_permBTD w_DTAX w_abnBTD w_SHELTER, matrix quietly
esttab . using "table3.rtf", replace notype unstack compress noobs nogaps nostar ///
title({\b Table 3, Panel A:} {\i Correlations}) ///
label varwidth(8) modelwidth(7) ///
nonotes nonumbers
* correlate gives same results as spearman when correlating ranked variables. Output full matrix to enable easy cut and paste into upper half of pwcorr correlation matrix above.
estpost correlate rETR1 rETR2 rETR3 rETR4 rBTD rpBTD rDTAX raBTD rSCOR, matrix nohalf quietly
esttab . using "table3.rtf", append notype unstack compress noobs nogaps nostar ///
title({\b Table 3, Panel B:} {\i Spearman Rank Correlations}) ///
varwidth(8) modelwidth(7) ///
nonotes nonumbers
Nick Cox
You can always get Spearman rank correlations by ranking the variables and then running -correlate-. That's what they are.
Amy Dunbar
3. Is there a way to estimate Spearman correlations using -estpost-?
*
* 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/