| Date: | Mon, 18 May 2009 22:50:52 -0700 |
| Reply-To: | Umrao <umraoamit@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Umrao <umraoamit@GMAIL.COM> |
| Organization: | http://groups.google.com |
| Subject: | variance covariance matrix |
|
| Content-Type: | text/plain; charset=ISO-8859-1 |
I have a variance-covariance matrix COV. The diagonal numbers are the
variances and the off diagonal numbers are the covriances.
COV={0.644607 0.1680246 1.483855 1.6281761
0.7427545,
0.1680246 0.0626773 0.2708275 0.1894284 0.2474915,
1.483855 0.2708275 4.8090391 5.3790562
1.8120638,
1.6281761 0.1894284 5.3790562 8.7463271
0.6100965,
0.7427545 0.2474915 1.8120638
0.6100965 2.2213662};
Is there any procedure to convert the off diagonal numbers that are
the covariances into correlations.
i.e., for the second element int he first row i whant to calculate the
value as 0.1680246/sqrt(0.644607*0.0626773)
this i have to do for all the offdiagonal elements.
The new matrix becomes a variance-correlation matrix as
varcorr={0.644607 0.835930597 0.842781127 0.685710831 0.620708515,
0.835930597 0.0626773 0.493296992 0.255845094 0.663277199,
0.842781127 0.493296992 4.8090391 0.829400075
0.554414079,
0.685710831 0.255845094 0.829400075 8.7463271
0.13841259,
0.620708515 0.663277199 0.554414079 0.13841259 2.2213662};
I have to apply the formula for correlation= cov(x,y)/sqrt{var(x)*var
(y)} to all the offdiagonal elements of the variance-covariance
matrix COV.
|