Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: tabulate, summarize() for svy data
From
Steve Samuels <[email protected]>
To
[email protected]
Subject
Re: st: tabulate, summarize() for svy data
Date
Fri, 19 Mar 2010 11:41:55 -0400
On Fri, Mar 19, 2010 at 9:34 AM, Ricardo Ovaldia <[email protected]> wrote:
> Steve,
>
> Why does your program use e(V_srssub) for the variance, instead of e(V) or e(V_srs).
I made a serious error in the code. The revision is below.
To answer your question:
the -over()- optioon triggers variance estimates appropriate for
subpopulations, just as a - survey, subpop()- prefix would have
done.
e(V) is the estimated variance of for each mean (square of standard error)
e(V_srs) is the estimated variance for each mean, if there had been
simple random sampling of the entire population
e(V_srssub) is the estimated variance for each mean if there had been
simple random sampling within each subpopulation. (The full
designation is "e(V_srssubpop)")
See the section on Design Effects with subpopulations on page 35 of
the Version 11 Survey Manual.
To estimate the variance of the observations in each subpopulation,
it's necessary to multiply the variance of the mean by the sample
size of the population. I forgot to do that. Also, I changed the
names of the matrices to avoid potential ambiguities. Here is the
corrected version.
**************************CODE BEGINS**************************
sysuse auto, clear
svyset _n
svy: mean mpg, over(foreign)
matrix define mm = e(b) //mean (already shown)
matrix define VV = e(V_srssub) // variances for subpopulations
matrix define nn = e(_N) //sample sizes
local kk = colsof(V)
forvalues i = 1/`kk'{
di `i' " " el(mm,1,`i') " " sqrt(el(nn,1,`i')*el(VV,`i',`i')) " "
el(nn,1,`i')
}
***************************CODE ENDS***************************
Steven Samuels
[email protected]
18 Cantine's Island
Saugerties NY 12477
USA
845-246-0774
*
* 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/