Stata has a package for survey sampling: svy. Here are steps to get sample mean, standard errors and design effects in Stata.
1. Declare sample design (weight, primary sampling units, strata, etc)
svyset [pweight=factor], psu(psuid) strata(strataid)
*stata 9 or 10
svyset upm [pweight=factor], strata(strataid)
2. Compute sample mean, standard errors & design effects
gen sigma = sqrt(e(N) * el(e(V_srs),1,1))
svymean income, by(sex)
gen sigma1 = sqrt(el(e(_N),1,1) * el(e(V_srs),1,1))
gen sigma2 = sqrt(el(e(_N),1,2) * el(e(V_srs),2,2))
svy: mean income
estat effect *design effect
svy: mean income, over(sex)
The design effect is correct in stata 8.2 using svymean. But it is wrong in stata 9 or 10 using svy: mean. We have to use estat effect to get correct design effect in stata 9 or 10.
1 hour ago