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

From |
René Geppert <geppert.rene@googlemail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: re: combined Correlationmatrix Pearson and Spearman + LaTeX output |

Date |
Wed, 17 Dec 2008 14:47:24 +0100 |

Sorry for the hasty question.

(pw)corr and spearman do not seem to explicitly provide for such an option. Nonetheless, thank you very much for the nice result. regards, R. Geppert René Geppert schrieb:

Sorry for the late answer Mr. Baum,but could you (or someone else) give me an example of thie code usinga dataset such as: .sysuse auto ?I cannot get it working for some reason. regards, R. Geppert Kit Baum schrieb:< > René said Is there a way to do pairwise Pearson AND Spearman Correlations in a single matrix, such as Pearson in the lower left and Spearman in the upper right traingle of the matrix? Provided, that is even possible. Is there a nice way to ouput such a correlation matrix to LaTeX? The following requires -outtable- from SSC (ssc install outtable) ------------------- capt prog drop corrmat *! corrmat CFB 2008dec09 prog corrmat version 10.1 syntax varlist(numeric) using/ qui spearman `varlist', pw tempname c mat `c' = r(Rho) local k: word count `varlist' forv i = 2/`k' { local f: word `i' of `varlist' forv j = 1/`=`i'-1' { local s: word `j' of `varlist' qui corr `f' `s' mat `c'[`i', `j'] = r(rho) } } outtable using `using', mat(`c') replace format(%9.4f) di _n "Spearman/Pearson correlations written to `using'.tex" _n end --------------------Stupidly, -pwcorr- returns nothing useful in its return list---merelythe correlation of the last variable with itself, which ispredictably unity. Thus regular -corr- is used here, invoked pairwiseto avoid listwise deletion due to missing values.To test, sysuse auto corrmat price mpg rep78 using testcorrmat type testcorrmat.tex Kit Baum, Boston College Economics and DIW Berlin http://ideas.repec.org/e/pba1.html An Introduction to Modern Econometrics Using Stata: http://www.stata-press.com/books/imeus.html * * 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/

* * 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/

**Follow-Ups**:**RE: st: re: combined Correlationmatrix Pearson and Spearman + LaTeX output***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: re: combined Correlationmatrix Pearson and Spearman + LaTeX output***From:*Kit Baum <baum@bc.edu>

**Re: st: re: combined Correlationmatrix Pearson and Spearman + LaTeX output***From:*René Geppert <geppert.rene@googlemail.com>

- Prev by Date:
**RE: st: Correction for bias in regression estimates after log transformation** - Next by Date:
**Re: st: Correction for bias in regression estimates after log transformation** - Previous by thread:
**Re: st: re: combined Correlationmatrix Pearson and Spearman + LaTeX output** - Next by thread:
**RE: st: re: combined Correlationmatrix Pearson and Spearman + LaTeX output** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |