Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -corrtable- available from SSC


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: -corrtable- available from SSC
Date   Fri, 30 Nov 2007 15:46:06 -0000

Thanks to Kit Baum, a new module -corrtable- is available
from SSC. Stata 8 is required. Use -ssc- to install if
interested, and even if not interested. 

-corrtable- is for presenting correlation matrices 
as graphical tables: not as "heat maps" or the like, but 
as tables produced by -graph-, with the possibilities that allows. 

-corrtable- arose because a colleague was somewhat frustrated
in getting a correlation matrix in the form he wanted out 
of Stata and into his favourite word processor (not a word shall 
escape me on which that is, but it isn't my own favourite way 
of producing documents). 

As often happens, a different approach to get round his problems 
turned out to be something that might be more generally useful, 
to me and perhaps others. 

The basic idea is very simple. Each cell in a correlation matrix 
is a correlation like say (to 3 d.p.) 

	0.420 

which we could put on a single graph like this: 

twoway scatteri 1 1 "0.420", ms(none) mlabsize(*7) xscale(r(0 2) off)
yscale(r(0 2) off) mlabpos(0)

It is unlikely that you would want to do this for an individual
correlation, 
but looping over pairs of variables would give you a matrix of graphs
that
you can then -combine-. And other modifications then are relatively
easy, 
including formatting with different numbers of decimal places, adding 
information on sample size (if that differs between correlations) and 
P-value, changing the font according to the correlation and changing 
the background colour to indicate different classes. 

-corrtable- is the result. The help file is quite detailed and lays 
down all kinds of reservations, not least that this can be 
slooooooooooooooooooooooowwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww. 
To repeat another: -corrtable- does not 
support starring systems such as * ** *** for different levels of 
significance and I have no intention of implementing any. I don't have, 
or even want, the power to stop others cloning the program and 
implementing that, but I decline to do it myself. Most P-values
for correlations are not worth much any way insofar, as the assumptions 
of mutual independence and bivariate normality are often a matter of
faith. 

Also, correlation matrices are almost always much less informative
than scatter plot matrices, but you know that anyway. 

But I shouldn't disparage my own program. I guess some people 
will enjoy playing with it a bit. If you ever need to give
a talk including little correlation matrices, this is a way 
of going beyond a very mundane table -- and, positively, 
highlights and patterns in your table can be made clearer 
without graphamatazz. 

I showed the results to someone 
who uses quite different software and was told, "Oh, that 
would be _very_ fiddly programming in ??????". I am not 
clear how to quantify that against the few hours I spent 
on this piece of Stata, but there you are. 

Nick 
n.j.cox@durham.ac.uk 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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