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

From |
Kit Baum <baum@bc.edu> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Tue, 9 Dec 2008 21:53:06 -0500 |

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

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/

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

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

- Prev by Date:
**st: combined Correlationmatrix Pearson and Spearman + LaTeX output** - Next by Date:
**Rép. : st: RE: Rép. : st: Re: Exporting results after -table-** - Previous by thread:
**st: combined Correlationmatrix Pearson and Spearman + LaTeX output** - Next by thread:
**st: RE: re: combined Correlationmatrix Pearson and Spearman + LaTeX output** - Index(es):

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