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

From |
Joseph Coveney <jcoveney@bigplanet.com> |

To |
Statalist <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: confidence interval for covariance |

Date |
Thu, 29 Sep 2005 09:50:29 +0900 |

Roger Harbord wrote: Does anyone know how to find a confidence interval for the covariance of 2 variables (NB not the correlation) based on a sample of iid observations from (approximately) a bivariate normal distribution? Stata code would be ideal (esp if it allows aweights), but a formula or a reference would be a great help too. I guess i could always bootstrap but my sample sizes are rather small (often around 5 to 30). -------------------------------------------------------------------------------- It doesn't allow aweights and it's asymptotic, which is a little dicey with sample sizes of 5 to 30, but -xtmixed- will provide confidence intervals for the variance of the random effect of iid pairs of observations, which is the covariance of the two observations. You should also be able to get there via a Fisher z-transform of the correlation coefficient, again asymptotic. For a reference to the latter (and to an apparently more accurate "Ruben's approximation"), see the link in the posting to a related question earlier this month ( www.stata.com/statalist/archive/2005-09/msg00544.html ). Joseph Coveney clear set more off set seed `=date("2005-09-29", "ymd")' set obs 30 generate float observation0 = invnorm(uniform()) generate float observation1 = 0.5 * observation0 + /// sqrt(1 - 0.5^2) * invnorm(uniform()) correlate observation*, covariance generate byte pair_id = _n reshape long observation, i(pair_id) j(member_indicator) xtmixed observation member_indicator || pair_id:, variance nolrtest clear set obs 5 generate float observation0 = invnorm(uniform()) generate float observation1 = 0.5 * observation0 + /// sqrt(1 - 0.5^2) * invnorm(uniform()) correlate observation*, covariance generate byte pair_id = _n reshape long observation, i(pair_id) j(member) xtmixed observation member || pair_id:, variance nolrtest exit * * 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/

- Prev by Date:
**RE: st: Collapse & Missing Values** - Next by Date:
**RE: st: Collapse & Missing Values** - Previous by thread:
**st: confidence interval for covariance** - Next by thread:
**[no subject]** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |