Statalist


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

st: RE: covariance matrix


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: covariance matrix
Date   Mon, 17 Dec 2007 18:58:40 -0000

See e.g. 


[M-5]   corr()  . . . . . . . . . Make correlation matrix from variance
matrix
        (help [M-5] corr())

[M-5]   mean()  . . . . . . . . . . . . . . Means, variances, and
correlations
        (help [M-5] mean())

FAQ     . . . . . . . . . . . . . . . . . . . Obtaining the correlation
matrix
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W.
Gould
        12/99   How can I obtain the correlation matrix as a Stata
                matrix?
                http://www.stata.com/support/faqs/stat/rho.html

corrmat from http://www.stata.com/users/sdriver
    corrmat.  Create and save correlation or covariance matrices.  /
Program
    by Shannon Driver, StataCorp <[email protected]>. / Creates a
correlation
    matrix, covariance matrix, or both and optionally / saves them in
the
    return list and/or matrix dir.

cpcorr from http://fmwww.bc.edu/RePEc/bocode/c
    'CPCORR': module for correlations for each row vs each column
variable /
    cpcorr produces a matrix of correlations for rowvarlist versus /
    colvarlist. cpspear does the same for Spearman correlations. This /
matrix
    may thus be oblong, and need not be square. Both also / allow a
single

STB-56  dm79  . . . . . . . . . . . . . . . . . . Yet more new matrix
commands
        (help matcorr, matewmf, matvsort, svmat2 if installed)  . .  N.
J. Cox
        7/00    pp.4--8; STB Reprints Vol 10, pp.17--23
        commands to produce a correlation matrix, elementwise monadic
        function of another matrix, selected subsets of matrix rows
        and columns, vec or vech of a matrix, elements sorted within
        a vector, matrix from a vector, and commands to save matrices
        see mata matrix language incorporated into Stata 9.0

David Kantor

How can I capture the covariance matrix of a set of variables?
If I do
  corr varlist, cov
I get returned scalars of the variance and covariance of the first 
two variables. I though I should be able to get the whole matrix.

Am I missing something?

I suppose I can compute the covariance of each pair of variables and 
deposit the results into a matrix, but I thought that I wouldn't need 
to do that.

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index