Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: tabulate, summarize() for svy data

From   Steve Samuels <>
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 <> 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

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'))  " "
***************************CODE ENDS***************************

Steven Samuels
18 Cantine's Island
Saugerties NY 12477
*   For searches and help try:

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