Dear Nick:
Thank you for your help. I tried what you suggest but I face difficulties at the first two steps (given my insufficient knowledge of matrices).
Before contacting you, I tried to solve the issue with the Stata manual.
1. Get pairwise correlation matrix, say -pearson-.
I did the following:
matrix accum R = var1 var2,nocons dev
matrix R = corr(R)
matrix list R
I checked that I get the correct coefficients (comparing with -pwcorr-).
Is this method correct?
With -pwcorr-, I can get the p-value. Is there a way to also include the p-value in the matrix?
2. Get pairwise Spearman correlation matrix, say -spearman-.
I did not find a solution. I guess there must be something equivalent to corr(R) for Spearman.
Best regards
Hervé Stolowy
***********************************************************
Professeur/Professor
Coordinateur du Département/Head of Department
HEC Paris
Département Comptabilité Contrôle de gestion / Dept of Accounting and Management Control
1, rue de la Liberation
78351 - Jouy-en-Josas
France
Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
stolowy#hec.fr (replace # by @)
http://studies.hec.fr/web/stolowy
>>> n.j.cox@durham.ac.uk 08/21/06 10:00 PM >>>
Despite your question, doing this synchronously
does not seem especially important to what you
want here. I suppose you could get two
Statas working more or less in unison, but they
would still need to talk to each other.
A recipe for the hybrid matrix is
1. Get pairwise correlation matrix, say -pearson-.
2. Get pairwise Spearman correlation matrix, say -spearman-.
3. Loop over rows and columns one side of the principal
diagonal:
matrix both = pearson
local I = rowsof(pearson)
forval i = 1/`I' {
local j1 = `i' + 1
forval j = `j1'/`I' {
matrix both[`i',`j'] = spearman[`i',`j']
}
}
4.
matrix list both
As each matrix is square, either the number of rows or
the number of columns suffices to indicate the matrix size.
There are no doubt cuter ways to do it, especially in Mata, but this works.
I guess you want this as a compact display, not for further analysis.
Nick
n.j.cox@durham.ac.uk
Herve STOLOWY
Do you know if there is a possibility to run -pwcorr- and -spearman-
jointly (i.e., on the same variables at the same time) in order to get
the results in only one matrix: with the -pwcorr- results in the lower
left triangle and the -spearman- results in the upper right triangle (or
the reverse presentation)?
*
* 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/
*
* 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/