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, **statalist.org** is already up and running.

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

From |
Steve Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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 <ovaldia@yahoo.com> 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 sjsamuels@gmail.com 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/

**Follow-Ups**:**Re: st: tabulate, summarize() for svy data***From:*Ricardo Ovaldia <ovaldia@yahoo.com>

**References**:**Re: st: tabulate, summarize() for svy data***From:*Steve Samuels <sjsamuels@gmail.com>

**Re: st: tabulate, summarize() for svy data***From:*Ricardo Ovaldia <ovaldia@yahoo.com>

- Prev by Date:
**st: Course: Advanced Stata- programming and other techniques to make your life easier** - Next by Date:
**Re: st: Average of Sample vesus Sub-Samples** - Previous by thread:
**Re: st: tabulate, summarize() for svy data** - Next by thread:
**Re: st: tabulate, summarize() for svy data** - Index(es):