Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Confidence intervals using svymean


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: Re: Confidence intervals using svymean
Date   Mon, 26 Jul 2004 09:51:38 -0400

Note that this solution only works when there are no missing data, or the "complete" option is specified with -svymean-. If the various means are calculated based on different samples, then the estimates are returned in e(est), not e(b); the variances are in e(V_db); and the degrees of freedom may vary from case to case. So:


svymean x1 x2
mat v=e(V)
mat b=e(est)
svymean x1 x2
mat v=e(V_db)
mat b=e(est)
mat dof = e(_N_psu) - e(_N_str)

scalar tval1 = invttail(dof[1,1],.025)
scalar x1ci95lo = b[1,1]-sqrt(v[1,1])*tval1
scalar x1ci95hi = b[1,1]+sqrt(v[1,1])*tval1

scalar tval2 = invttail(dof[1,2],0.025)
scalar x2ci95lo = b[1,2]-sqrt(v[1,2])*tval2
scalar x2ci95hi = b[1,2]+sqrt(v[1,2])*tval2

Note that e(V_db) is NOT a diagonal matrix--it is a row-vector of variances, because with different samples, the covariances of the estimates cannot be calculated.

--Nick Winter

At 02:14 PM 7/25/2004 -0400, you wrote:

You need to look at the var/covar matrix in e(V).  You can get the standard
errors as the square roots of the diagonal elements. You need to calculate
your own confidence intervals from this using info about d.f.  For example:

svymean x1 x2
mat v=e(V)
mat b=e(b)
scalar tval= invttail(`e(df_r)',.025)
scalar x1ci95lo=b[1,1]-sqrt(v[1,1])*tval
scalar x1ci95hi=b[1,1]+sqrt(v[1,1])*tval
scalar x2ci95hi=b[1,2]+sqrt(v[2,2])*tval
...
Michael Blasnik
[email protected]

----- Original Message -----
From: "Joao Pedro W. de Azevedo" <[email protected]>
To: <[email protected]>
Sent: Saturday, July 24, 2004 8:03 PM
Subject: st: Confidence intervals using svymean


> Dear Stata users,
> I would like to know if anyone knows how I could save the confidence
> intervals after using svymean.
> I've tried both ereturn list and return list, and neither one of them
> presented me matrix that reseambled either the confidence intervals or the
> std erros.
> Am I missing something?
> Many thanks in advance,
> JP
>


*
*   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/
--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601

*
* 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/




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