[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Storing a correlation matrix
-makematrix- can do this with the -listwise- option.
-makematrix- is downloadable from SSC.
Here is a dopey example.
. sysuse auto, clear
(1978 Automobile Data)
. makematrix , from(r(rho)) listwise : corr price-rep78
price mpg rep78
mpg -.46859669 1
rep78 .00655327 .40234039 1
Making a matrix from the sample sizes shows the
. makematrix , from(r(N)) listwise : corr price-rep78
price mpg rep78
mpg 74 74
rep78 69 69 69
There are, naturally, options for saving the matrix,
and so forth.
-makematrix- was discussed in the Stata Journal:
SJ-3-4 pr0011 . . . . . . . . Speaking Stata: Problems with tables, Part II
Q4/03 SJ 3(4):420--439 (no commands)
reviews three user-written commands (tabcount, makematrix,
and groups) as different approaches to tabulation problems
Marcello is an Associate Editor of the Stata Journal,
and so should have a copy...
Note that neither SSC, nor the author of -makematrix-,
nor the Editors of the Stata Journal are to be held
responsible for the eigenconsequences, positive
or negative, definite or indefinite, of matrices
based on varying subsets of the data.
> Bill Gould in 1999 answered the question of how to store pairwise
> correlations of a varlist in a matrix--basically calculate the
> covariance matrix and then convert it into a correlation matrix. The
> problem with that answer is that it does not use all the
> the difference between -corr-and -pwcorr-. Does anyone have a better
> answer, one that uses all the data, like -pwcorr- does?
* For searches and help try: