Rida Zaidi wrote:
This may be a v. basic question - but how does one compute and store
covariances in stata ?
For the standard deviations I only do egen x_sd=sd(varx)
How do I obtain the covariance between two of my variables ?
--------------------------------------------------------------------------------
Stata's command -correlate- will compute covariance. You can store it (in
the same sense as you store something with -egen-) by generating a variable
to contain the returned scalar. This is illustrated below, along with
something basic that I learned on the List today. Does R's output report
that the variable has been transformed?
Joseph Coveney
sysuse auto
correlate headroom gear_ratio, covariance
generate float xy_cov = r(cov_12)
expr: correlate sqrt(headroom) log10(gear_ratio)
*
* 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/