Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: How to store the covariance values for further manupulations


From   "Kieran McCaul" <[email protected]>
To   <[email protected]>
Subject   st: RE: How to store the covariance values for further manupulations
Date   Sat, 22 Aug 2009 05:08:39 +0800

....

I don't know how your country variables is coded, but let's assume you
had twenty countries coded 1 to 20, then the following will create a new
variable, cov, that contains the covariance between var1 and var2 for
each country.  It's a bit inelegant, but it will at least show how you
can save the covariances.


gen cov=.
forvalues i=1/20 {
   corr var1 var2 if country==`i', c
   replace cov = `r(cov_12)' if country==`i'
}


______________________________________________
Kieran McCaul MPH PhD
WA Centre for Health & Ageing (M573)
University of Western Australia
Level 6, Ainslie House
48 Murray St
Perth 6000
Phone: (08) 9224-2701
Fax: (08) 9224 8009
email: [email protected]
http://myprofile.cos.com/mccaul 
http://www.researcherid.com/rid/B-8751-2008
______________________________________________
If you live to be one hundred, you've got it made.
Very few people die past that age - George Burns


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of mariam ouchen
Sent: Saturday, 22 August 2009 2:07 AM
To: [email protected]
Subject: st: How to store the covariance values for further
manupulations

Good day statalisters
Actually I'm faced with a problem, I'm using the command  by country:
corr var1 var2, Cov to obtain the matrix variance covariance,
but what i'need is the covariance values to compute sqrt(-2cov), how
can'i do this ?how can'i store the covariance values for my
manupulation?

Many thanks in advance!!!
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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