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

st: combined Pearson and Spearman (listwise ) + LATEX

From   Katja Schulze <>
Subject   st: combined Pearson and Spearman (listwise ) + LATEX
Date   Mon, 18 May 2009 20:26:16 +0200

Dear all, 

I would like to create LISTWISE Pearson and Spearman Correlations in a single matrix (similar to René, see below) and put this into LATEX.
My problem is, that I only have Stata 10 version, and cannot update to Stata 10.1 (It returns the error: cannot write in directory C:\Program Files\Stata10\ado\updates\). So is there a program command similar to the one below for Stata 10?

And I would like to display the p-value in parantheses below. And all numbers should have only three decimals.

Thanx a lot for your help!!! This would be great!


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

GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter

*   For searches and help try:

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