Stata Survey Data Reference Manual: Release 14
Stata Survey Data Reference Manual: Release 14
Stata Survey Data Reference Manual: Release 14
MANUAL
RELEASE 14
Published by Stata Press, 4905 Lakeway Drive, College Station, Texas 77845
Typeset in TEX
ISBN-10: 1-59718-167-6
ISBN-13: 978-1-59718-167-9
This manual is protected by copyright. All rights are reserved. No part of this manual may be reproduced, stored
in a retrieval system, or transcribed, in any form or by any means—electronic, mechanical, photocopy, recording, or
otherwise—without the prior written permission of StataCorp LP unless permitted subject to the terms and conditions
of a license granted to you by StataCorp LP to use the software and documentation. No license, express or implied,
by estoppel or otherwise, to any intellectual property rights is granted by this document.
StataCorp provides this manual “as is” without warranty of any kind, either expressed or implied, including, but
not limited to, the implied warranties of merchantability and fitness for a particular purpose. StataCorp may make
improvements and/or changes in the product(s) and the program(s) described in this manual at any time and without
notice.
The software described in this manual is furnished under a license agreement or nondisclosure agreement. The software
may be copied only in accordance with the terms of the agreement. It is against the law to copy the software onto
DVD, CD, disk, diskette, tape, or any other medium for any purpose other than backup or archival purposes.
The automobile dataset appearing on the accompanying media is Copyright
c 1979 by Consumers Union of U.S.,
Inc., Yonkers, NY 10703-1057 and is reproduced by permission from CONSUMER REPORTS, April 1979.
Stata, , Stata Press, Mata, , and NetCourse are registered trademarks of StataCorp LP.
Stata and Stata Press are registered trademarks with the World Intellectual Property Organization of the United Nations.
NetCourseNow is a trademark of StataCorp LP.
Other brand and product names are registered trademarks or trademarks of their respective companies.
For copyright information about the software, type help copyright within Stata.
i
ii Contents
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
iii
Title
intro — Introduction to survey data manual
Description
This manual documents the survey data commands and is referred to as [SVY] in references.
After this entry, [SVY] survey provides an overview of the survey commands. This manual is
arranged alphabetically. If you are new to Stata’s survey data commands, we recommend that you
read the following sections first:
Stata is continually being updated, and Stata users are continually writing new commands. To
find out about the latest survey data features, type search survey after installing the latest official
updates; see [R] update.
Also see
[U] 1.3 What’s new
[R] intro — Introduction to base reference manual
1
Title
survey — Introduction to survey commands
Description
The Survey Data Reference Manual is organized alphabetically, making it easy to find an individual
entry if you know the name of a command. This overview organizes and presents the commands
conceptually, that is, according to the similarities in the functions they perform.
2
survey — Introduction to survey commands 3
Introduction
Stata’s facilities for survey data analysis are centered around the svy prefix command. After you
identify the survey design characteristics with the svyset command, prefix the estimation commands
in your data analysis with “svy:”. For example, where you would normally use the regress command
to fit a linear regression model for nonsurvey data, use svy: regress to fit a linear regression model
for your survey data.
Why should you use the svy prefix command when you have survey data? To answer this question,
we need to discuss some of the characteristics of survey design and survey data collection because
these characteristics affect how we must perform our analysis if we want to get it right.
Survey data are characterized by the following:
• Sampling weights, also called probability weights — pweights in Stata’s terminology
• Cluster sampling
• Stratification
These features arise from the design and details of the data collection procedure. Here’s a brief
description of how these design features affect the analysis of the data:
• Sampling weights. In sample surveys, observations are selected through a random process,
but different observations may have different probabilities of selection. Weights are equal to
(or proportional to) the inverse of the probability of being sampled. Various postsampling
adjustments to the weights are sometimes made, as well. A weight of wj for the j th observation
means, roughly speaking, that the j th observation represents wj elements in the population
from which the sample was drawn.
Omitting weights from the analysis results in estimates that may be biased, sometimes seriously
so. Sampling weights also play a role in estimating standard errors.
• Clustering. Individuals are not sampled independently in most survey designs. Collections of
individuals (for example, counties, city blocks, or households) are typically sampled as a group,
known as a cluster.
There may also be further subsampling within the clusters. For example, counties may be
sampled, then city blocks within counties, then households within city blocks, and then finally
persons within households. The clusters at the first level of sampling are called primary sampling
units (PSUs) — in this example, counties are the PSUs. In the absence of clustering, the PSUs
are defined to be the individuals, or, equivalently, clusters, each of size one.
Cluster sampling typically results in larger sample-to-sample variability than sampling individuals
directly. This increased variability must be accounted for in standard error estimates, hypothesis
testing, and other forms of inference.
4 survey — Introduction to survey commands
• Stratification. In surveys, different groups of clusters are often sampled separately. These groups
are called strata. For example, the 254 counties of a state might be divided into two strata, say,
urban counties and rural counties. Then 10 counties might be sampled from the urban stratum,
and 15 from the rural stratum.
Sampling is done independently across strata; the stratum divisions are fixed in advance. Thus
strata are statistically independent and can be analyzed as such. When the individual strata
are more homogeneous than the population as a whole, the homogeneity can be exploited to
produce smaller (and honestly so) estimates of standard errors.
To put it succinctly: using sampling weights is important to get the point estimates right. We must
consider the weighting, clustering, and stratification of the survey design to get the standard errors
right. If our analysis ignores the clustering in our design, we would probably produce standard errors
that are smaller than they should be. Stratification can be used to get smaller standard errors for a
given overall sample size.
For more detailed introductions to complex survey data analysis, see Cochran (1977); Heeringa,
West, and Berglund (2010); Kish (1965); Levy and Lemeshow (2008); Scheaffer et al.; (2012);
Skinner, Holt, and Smith (1989); Stuart (1984); Thompson (2012); and Williams (1978).
In addition to the variables we specified, svyset reports that the default method for estimating
standard errors is Taylor linearization and that svy will report missing values for the standard errors
when it encounters a stratum with one sampling unit (also called singleton strata).
survey — Introduction to survey commands 5
We saved the svyset dataset to highschool.dta. We can now use this new dataset without having
to worry about respecifying the design characteristics.
. clear
. describe
Contains data
obs: 0
vars: 0
size: 0
Sorted by:
. use highschool
. svyset
pweight: sampwgt
VCE: linearized
Single unit: missing
Strata 1: state
SU 1: county
FPC 1: ncounties
Strata 2: <one>
SU 2: school
FPC 2: nschools
6 survey — Introduction to survey commands
After the design characteristics have been svyset, you should also look at [SVY] svydescribe. Use
svydescribe to browse each stage of your survey data; svydescribe reports useful information
on sampling unit counts, missing data, and singleton strata.
1 2 0 92 0 34 46.0 58
2 2 0 112 0 51 56.0 61
3 2 0 43 0 18 21.5 25
4 2 0 37 0 14 18.5 23
5 2 0 96 0 38 48.0 58
(output omitted )
46 2 0 115 0 56 57.5 59
47 2 0 67 0 28 33.5 39
48 2 0 56 0 23 28.0 33
49 2 0 78 0 39 39.0 39
50 2 0 64 0 31 32.0 33
4,071
From the output, we gather that there are 50 strata, each stratum contains two PSUs, the PSUs vary
in size, and the total sample size is 4,071 students. We can also see that there are no missing data
in the weight variable.
Linearized
Mean Std. Err. [95% Conf. Interval]
In its header, svy reports the number of strata and PSUs from the first stage, the sample size, an
estimate of population size, and the design degrees of freedom. Just like the standard output from
the mean command, the table of estimation results contains the estimated mean and its standard error
as well as a confidence interval.
Linearized
weight Coef. Std. Err. t P>|t| [95% Conf. Interval]
In addition to the header elements we saw in the previous example using svy: mean, the command
svy: regress also reports a model F test and estimated R2 . Although many of Stata’s model-fitting
commands report Z statistics for testing coefficients against zero, svy always reports t statistics and
uses the design degrees of freedom to compute p-values.
The svy prefix can be used with many estimation commands in Stata; see [SVY] svy estimation
for a list of estimation commands that support the svy prefix.
8 survey — Introduction to survey commands
The lung cancer information was taken from the 1992 NHEFS interview data. We use the participants’
ages for the time scale. Participants who never had lung cancer and were alive for the 1992 interview
were considered censored. Participants who never had lung cancer and died before the 1992 interview
were also considered censored at their age of death.
. stset age_lung_cancer [pw=swgt2], fail(lung_cancer)
failure event: lung_cancer != 0 & lung_cancer < .
obs. time interval: (0, age_lung_cancer]
exit on or before: failure
weight: [pweight=swgt2]
Although stset warns us that it is a “probable error” to have 5,126 observations with missing event
times, we can verify from the 1992 NHEFS documentation that there were indeed 9,281 participants
with complete information.
For our proportional hazards model, we pulled the risk factor information from the NHANES I and
1992 NHEFS datasets. Smoking status was taken from the 1992 NHEFS interview data, but we filled
in all but 132 missing values by using the general medical history supplement data in NHANES I.
Smoking status is represented by separate indicator variables for former smokers and current smokers;
the base comparison group is nonsmokers. Sex was determined using the 1992 NHEFS vitality data
and is represented by an indicator variable for males. Place-of-residence information was taken from
the medical history questionnaire in NHANES I and is represented by separate indicator variables for
rural and heavily populated (more than 1 million people) urban residences; the base comparison group
is urban residences with populations of fewer than 1 million people.
survey — Introduction to survey commands 9
Linearized
_t Haz. Ratio Std. Err. t P>|t| [95% Conf. Interval]
From the above results, we can see that both former and current smokers have a significantly
higher risk for developing lung cancer than do nonsmokers.
svy: tabulate can be used to produce one-way and two-way tables with survey data and can
produce survey-adjusted tests of independence for two-way contingency tables; see [SVY] svy: tabulate
oneway and [SVY] svy: tabulate twoway.
. use http://www.stata-press.com/data/r14/nhanes2b
. svy: tabulate race diabetes, row se ci format(%7.4f)
(running tabulate on estimation sample)
Number of strata = 31 Number of obs = 10,349
Number of PSUs = 62 Population size = 117,131,111
Design df = 31
1=white,
2=black, diabetes, 1=yes, 0=no
3=other 0 1 Total
svy: tabulate has many options, such as the format() option, for controlling how the table
looks. See [SVY] svy: tabulate twoway for a discussion of the different design-based and unadjusted
tests of association.
All the standard postestimation commands (for example, estimates, lincom, margins, nlcom,
test, testnl) are also available after svy.
. use http://www.stata-press.com/data/r14/highschool
. svy: mean weight, over(sex)
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 50 Number of obs = 4,071
Number of PSUs = 100 Population size = 8,000,000
Design df = 50
male: sex = male
female: sex = female
Linearized
Over Mean Std. Err. [95% Conf. Interval]
weight
male 175.4809 1.116802 173.2377 177.7241
female 146.204 .9004157 144.3955 148.0125
Here we use the test command to test the hypothesis that the average male is 30 pounds heavier
than the average female; from the results, we cannot reject this hypothesis at the 5% level.
. test [weight]male - [weight]female = 30
Adjusted Wald test
( 1) [weight]male - [weight]female = 30
F( 1, 50) = 0.23
Prob > F = 0.6353
estat has specific subroutines for use after svy; see [SVY] estat.
• estat svyset reports the survey design settings used to produce the current estimation results.
• estat effects and estat lceffects report a table of design and misspecification effects
for point estimates and linear combinations of point estimates, respectively.
• estat size reports a table of sample and subpopulation sizes after svy: mean, svy: pro-
portion, svy: ratio, and svy: total.
• estat sd reports subpopulation standard deviations on the basis of the estimation results from
mean and svy: mean.
• estat strata reports the number of singleton and certainty strata within each sampling stage.
• estat cv reports the coefficient of variation for each coefficient in the current estimation results.
• estat gof reports a goodness-of-fit test for binary response models using survey data.
12 survey — Introduction to survey commands
Linearized
Over Mean Std. Err. DEFF DEFT
weight
male 175.4809 1.116802 2.61016 1.61519
female 146.204 .9004157 1.7328 1.31603
Now we use estat lceffects to report the design effects DEFF and DEFT for the difference of
the mean estimates from the previous example.
. estat lceffects [weight]male - [weight]female
( 1) [weight]male - [weight]female = 0
The svy brr prefix command produces point and variance estimates by using the BRR method;
see [SVY] svy brr. BRR was first introduced by McCarthy (1966, 1969a, and 1969b) as a method of
variance estimation for designs with two PSUs in every stratum. The BRR variance estimator tends to
give more reasonable variance estimates for this design than the linearized variance estimator, which
can result in large values and undesirably wide confidence intervals.
The svy jackknife prefix command produces point and variance estimates by using the jackknife
replication method; see [SVY] svy jackknife. The jackknife is a data-driven variance estimation
method that can be used with model-fitting procedures for which the linearized variance estimator is
not implemented, even though a linearized variance estimator is theoretically possible to derive (Shao
and Tu 1995).
To protect the privacy of survey participants, public survey datasets may contain replicate-weight
variables instead of variables that identify the PSUs and strata. These replicate-weight variables can be
used with the appropriate replication method for variance estimation instead of the linearized variance
estimator; see [SVY] svyset.
The svy brr and svy jackknife prefix commands can be used with those commands that may
not be fully supported by svy but are compatible with the BRR and the jackknife replication methods.
They can also be used to produce point estimates for expressions of estimation results from a prefixed
command.
The svy bootstrap and svy sdr prefix commands work only with replicate weights. Both assume
that you have obtained these weight variables externally.
survey — Introduction to survey commands 13
The svy bootstrap prefix command produces variance estimates that have been adjusted for
bootstrap sampling. Bootstrap sampling of complex survey has become more popular in recent years
and is the variance-estimation method used in the National Population Health Survey conducted by
Statistics Canada; see [SVY] svy bootstrap and [SVY] variance estimation for more details.
The svy sdr prefix command produces variance estimates that implement successive difference
replication (SDR), first introduced by Fay and Train (1995) as a method for annual demographic
supplements to the Current Population Survey. This method is typically applied to systematic samples
where the observed sampling units follow a natural order; see [SVY] svy sdr and [SVY] variance
estimation for more details.
Here is a privacy-conscious dataset equivalent to the one above; all the variables and values
remain, except that strata and psu are replaced with BRR replicate-weight variables. The BRR
replicate-weight variables are already svyset, and the default method for variance estimation is
vce(brr).
14 survey — Introduction to survey commands
. use http://www.stata-press.com/data/r14/nhanes2brr
. svyset
pweight: finalwgt
VCE: brr
MSE: off
brrweight: brr_1 brr_2 brr_3 brr_4 brr_5 brr_6 brr_7 brr_8 brr_9 brr_10
brr_11 brr_12 brr_13 brr_14 brr_15 brr_16 brr_17 brr_18 brr_19
brr_20 brr_21 brr_22 brr_23 brr_24 brr_25 brr_26 brr_27 brr_28
brr_29 brr_30 brr_31 brr_32
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
Suppose that we were interested in the population ratio of weight to height. Here we use total
to estimate the population totals of weight and height and the svy brr prefix to estimate their ratio
and variance; we use total instead of ratio (which is otherwise preferable here) to show how to
specify an expression when using svy: brr.
. svy brr WtoH = (_b[weight]/_b[height]): total weight height
(running total on estimation sample)
BRR replications (32)
1 2 3 4 5
................................
BRR results Number of obs = 10,351
Population size = 117,157,513
Replications = 32
Design df = 31
command: total weight height
WtoH: _b[weight]/_b[height]
BRR
Coef. Std. Err. t P>|t| [95% Conf. Interval]
. use http://www.stata-press.com/data/r14/highschool
. describe sex
storage display value
variable name type format label variable label
Here we generate a variable named male so that we can easily identify the male high school
seniors. We specified if !missing(sex); doing so will cause the generated male variable to contain
a missing value at each observation where the sex variable does. This is done on purpose (although it
is not necessary if sex is free of missing values) because missing values should not be misinterpreted
to imply female.
. generate male = sex == 1 if !missing(sex)
Now we specify subpop(male) as an option to the svy prefix in our model fit.
. svy, subpop(male): regress weight height
(running regress on estimation sample)
Survey: Linear regression
Number of strata = 50 Number of obs = 4,071
Number of PSUs = 100 Population size = 8,000,000
Subpop. no. obs = 1,938
Subpop. size = 3,848,021
Design df = 50
F( 1, 50) = 225.38
Prob > F = 0.0000
R-squared = 0.2347
Linearized
weight Coef. Std. Err. t P>|t| [95% Conf. Interval]
Although the table of estimation results contains the same columns as earlier, svy reports some
extra subpopulation information in the header. Here the extra header information tells us that 1,938
of the 4,071 sampled high school seniors are male, and the estimated number of male high school
seniors in the population is 3,848,021.
Direct standardization is an estimation method that allows comparing rates that come from different
frequency distributions; see [SVY] direct standardization. In direct standardization, estimated rates
(means, proportions, and ratios) are adjusted according to the frequency distribution of a standard
population. The standard population is partitioned into categories, called standard strata. The stratum
frequencies for the standard population are called standard weights. In the standardizing frequency
distribution, the standard strata are most commonly identified by demographic information such as
age, sex, and ethnicity. The standardized rate estimate is the weighted sum of unadjusted rates, where
the weights are the relative frequencies taken from the standardizing frequency distribution. Direct
standardization is available with svy: mean, svy: proportion, and svy: ratio.
16 survey — Introduction to survey commands
We can use svy: ratio to compute the death rates for each district in 1840. Because this
dataset is identified as census data, we will create an FPC variable that will contain a sampling
rate of 100%. This method will result in zero standard errors, which are interpreted to mean no
variability—appropriate because our point estimates came from the entire population.
survey — Introduction to survey commands 17
. gen fpc = 1
. svyset, fpc(fpc)
pweight: <none>
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: fpc
. svy: ratio (Bethnal: bgdeaths/bgliving) (Hanover: hsdeaths/hsliving)
(running ratio on estimation sample)
Survey: Ratio estimation
Number of strata = 1 Number of obs = 21
Number of PSUs = 21 Population size = 21
Design df = 20
Bethnal: bgdeaths/bgliving
Hanover: hsdeaths/hsliving
Linearized
Ratio Std. Err. [95% Conf. Interval]
Bethnal .0238095 0 . .
Hanover .0213384 0 . .
The death rates are 2.38% for Bethnal Green and 2.13% for St. George’s Hanover Square. These
observed death rates are not really comparable because they come from two different age distributions.
We can standardize based on the age distribution from Bethnal Green. Here age identifies our standard
strata and bgliving contains the associated population sizes.
. svy: ratio (Bethnal: bgdeaths/bgliving) (Hanover: hsdeaths/hsliving),
> stdize(age) stdweight(bgliving)
(running ratio on estimation sample)
Survey: Ratio estimation
Number of strata = 1 Number of obs = 21
Number of PSUs = 21 Population size = 21
N. of std strata = 21 Design df = 20
Bethnal: bgdeaths/bgliving
Hanover: hsdeaths/hsliving
Linearized
Ratio Std. Err. [95% Conf. Interval]
Bethnal .0238095 0 . .
Hanover .0266409 0 . .
The standardized death rate for St. George’s Hanover Square, 2.66%, is larger than the death rate
for Bethnal Green.
Poststratification is a method for adjusting the sampling weights, usually to account for under-
represented groups in the population; see [SVY] poststratification. This method usually results in
decreasing bias because of nonresponse and underrepresented groups in the population. It also tends to
18 survey — Introduction to survey commands
result in smaller variance estimates. Poststratification is available for all survey estimation commands
and is specified using svyset; see [SVY] svyset.
Linearized
Mean Std. Err. [95% Conf. Interval]
The mean total expenses is $40.12 with a standard error of $1.16. In the following, we omit the
poststratification information from svyset, resulting in mean total expenses of $39.73 with standard
error $2.22. The difference between the mean estimates is explained by the facts that expenses tend
to be larger for dogs than for cats and that the dogs were slightly underrepresented in the sample
(850/1,300 ≈ 0.65 for the population; 32/50 = 0.64 for the sample). This reasoning also explains why
the variance estimate from the poststratified mean is smaller than the one that was not poststratified.
survey — Introduction to survey commands 19
. svyset, fpc(fpc)
pweight: <none>
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: fpc
. svy: mean totexp
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 1 Number of obs = 50
Number of PSUs = 50 Population size = 50
Design df = 49
Linearized
Mean Std. Err. [95% Conf. Interval]
Example 14
The ml command requires a program that computes likelihood values to perform maximum
likelihood. Here is a likelihood evaluator used in Gould, Pitblado, and Poi (2010) to fit linear
regression models using the likelihood from the normal distribution.
program mynormal_lf
version 14
args lnf mu lnsigma
quietly replace ‘lnf’ = ln(normalden($ML_y1,‘mu’,exp(‘lnsigma’)))
end
Back in example 5, we fit a linear regression model using the high school survey data. Here we
use ml and mynormal lf to fit the same survey regression model.
20 survey — Introduction to survey commands
. use http://www.stata-press.com/data/r14/highschool
. ml model lf mynormal_lf (mu: weight = height) /lnsigma, svy
. ml max
initial: log pseudolikelihood = -<inf> (could not be evaluated)
feasible: log pseudolikelihood = -7.301e+08
rescale: log pseudolikelihood = -51944380
rescale eq: log pseudolikelihood = -47565331
Iteration 0: log pseudolikelihood = -47565331
Iteration 1: log pseudolikelihood = -41226725 (not concave)
Iteration 2: log pseudolikelihood = -41221650 (not concave)
Iteration 3: log pseudolikelihood = -41176159 (not concave)
Iteration 4: log pseudolikelihood = -41154139 (not concave)
Iteration 5: log pseudolikelihood = -41052368
Iteration 6: log pseudolikelihood = -39379181 (backed up)
Iteration 7: log pseudolikelihood = -38333242
Iteration 8: log pseudolikelihood = -38328742
Iteration 9: log pseudolikelihood = -38328739
Number of strata = 50 Number of obs = 4,071
Number of PSUs = 100 Population size = 8,000,000
Design df = 50
F( 1, 50) = 593.99
Prob > F = 0.0000
Linearized
weight Coef. Std. Err. t P>|t| [95% Conf. Interval]
mu
height .716311 .0293908 24.37 0.000 .6572778 .7753442
_cons -149.6181 12.57266 -11.90 0.000 -174.871 -124.3652
lnsigma
_cons 3.372153 .0180777 186.54 0.000 3.335843 3.408464
svymarkout is a programmer’s command that resets the values in a variable that identifies the
estimation sample, dropping observations for which any of the survey characteristic variables contain
missing values. This tool is most helpful for developing estimation commands that use ml to fit
models using maximum pseudolikelihood directly, instead of relying on the svy prefix.
Video examples
Basic introduction to the analysis of complex survey data in Stata
How to download, import, and merge multiple datasets from the NHANES website
How to download, import, and prepare data from the NHANES website
Acknowledgments
Many of the svy commands were developed in collaboration with John L. Eltinge of the Bureau
of Labor Statistics. We thank him for his invaluable assistance.
We thank Wayne Johnson of the National Center for Health Statistics for providing the NHANES II
dataset.
survey — Introduction to survey commands 21
We thank Nicholas Winter of the Politics Department at the University of Virginia for his diligent
efforts to keep Stata up to date with mainstream variance estimation methods for survey data, as well
as for providing versions of svy brr and svy jackknife.
William Gemmell Cochran (1909–1980) was born in Rutherglen, Scotland, and educated at the
Universities of Glasgow and Cambridge. He accepted a post at Rothamsted before finishing his
doctorate. Cochran emigrated to the United States in 1939 and worked at Iowa State, North
Carolina State, Johns Hopkins, and Harvard. He made many major contributions across several
fields of statistics, including experimental design, the analysis of counted data, sample surveys,
and observational studies, and was author or coauthor (with Gertrude M. Cox and George W.
Snedecor) of various widely used texts.
Leslie Kish (1910–2000) was born in Poprad, Hungary, and entered the United States with his
family in 1926. He worked as a lab assistant at the Rockefeller Institute for Medical Research and
studied at the College of the City of New York, fighting in the Spanish Civil War before receiving
his first degree in mathematics. Kish worked for the Bureau of the Census, the Department of
Agriculture, the Army Air Corps, and the University of Michigan. He carried out pioneering
work in the theory and practice of survey sampling, including design effects, BRR, response
errors, rolling samples and censuses, controlled selection, multipurpose designs, and small-area
estimation.
References
Cochran, W. G. 1977. Sampling Techniques. 3rd ed. New York: Wiley.
Cox, C. S., M. E. Mussolino, S. T. Rothwell, M. A. Lane, C. D. Golden, J. H. Madans, and J. J. Feldman. 1997.
Plan and operation of the NHANES I Epidemiologic Followup Study, 1992. In Vital and Health Statistics, series 1,
no. 35. Hyattsville, MD: National Center for Health Statistics.
Engel, A., R. S. Murphy, K. Maurer, and E. Collins. 1978. Plan and operation of the HANES I augmentation survey
of adults 25–74 years: United States 1974–75. In Vital and Health Statistics, series 1, no. 14. Hyattsville, MD:
National Center for Health Statistics.
Fay, R. E., and G. F. Train. 1995. Aspects of survey and model-based postcensal estimation of income and poverty
characteristics for states and counties. In Proceedings of the Government Statistics Section, 154–159. American
Statistical Association.
Gould, W. W., J. S. Pitblado, and B. P. Poi. 2010. Maximum Likelihood Estimation with Stata. 4th ed. College
Station, TX: Stata Press.
Heeringa, S. G., B. T. West, and P. A. Berglund. 2010. Applied Survey Data Analysis. Boca Raton, FL: Chapman
& Hall/CRC.
Kish, L. 1965. Survey Sampling. New York: Wiley.
Korn, E. L., and B. I. Graubard. 1999. Analysis of Health Surveys. New York: Wiley.
Kreuter, F., and R. Valliant. 2007. A survey on survey statistics: What is done and can be done in Stata. Stata Journal
7: 1–21.
Levy, P. S., and S. A. Lemeshow. 2008. Sampling of Populations: Methods and Applications. 4th ed. Hoboken, NJ:
Wiley.
McCarthy, P. J. 1966. Replication: An approach to the analysis of data from complex surveys. In Vital and Health
Statistics, series 2. Hyattsville, MD: National Center for Health Statistics.
. 1969a. Pseudoreplication: Further evaluation and application of the balanced half-sample technique. In Vital
and Health Statistics, series 2. Hyattsville, MD: National Center for Health Statistics.
. 1969b. Pseudo-replication: Half-samples. Revue de l’Institut International de Statistique 37: 239–264.
22 survey — Introduction to survey commands
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Miller, H. W. 1973. Plan and operation of the Health and Nutrition Examination Survey: United States 1971–1973.
Hyattsville, MD: National Center for Health Statistics.
Scheaffer, R. L., W. Mendenhall, III, R. L. Ott, and K. G. Gerow. 2012. Elementary Survey Sampling. 7th ed.
Boston: Brooks/Cole.
Shao, J., and D. Tu. 1995. The Jackknife and Bootstrap. New York: Springer.
Skinner, C. J., D. Holt, and T. M. F. Smith, ed. 1989. Analysis of Complex Surveys. New York: Wiley.
Stuart, A. 1984. The Ideas of Sampling. 3rd ed. New York: Griffin.
Thompson, S. K. 2012. Sampling. 3rd ed. Hoboken, NJ: Wiley.
Williams, B. 1978. A Sampler on Sampling. New York: Wiley.
Wolter, K. M. 2007. Introduction to Variance Estimation. 2nd ed. New York: Springer.
Also see
[SVY] svyset — Declare survey design for dataset
[SVY] svy — The survey prefix command
[SVY] svy estimation — Estimation commands for survey data
[P] robust — Robust variance estimates
Title
bootstrap options — More options for bootstrap variance estimation
Description
svy accepts more options when performing bootstrap variance estimation. See [SVY] svy bootstrap
for a complete discussion.
Syntax
bootstrap options Description
SE
mse use MSE formula for variance
nodots suppress replication dots
bsn(#) bootstrap mean-weight adjustment
saving( filename, . . .) save results to filename
verbose display the full table legend
noisily display any output from command
trace trace command
title(text) use text as the title for results
nodrop do not drop observations
reject(exp) identify invalid results
saving, verbose, noisily, trace, title(), nodrop, and reject() are not shown in the dialog boxes for estimation
commands.
Options
SE
mse specifies that svy compute the variance by using deviations of the replicates from the observed
value of the statistics based on the entire dataset. By default, svy computes the variance by using
deviations of the replicates from their mean.
nodots suppresses display of the replication dots. By default, one dot character is printed for each
successful replication. A red ‘x’ is displayed if command returns with an error, and ‘e’ is displayed
if at least one of the values in the exp list is missing.
bsn(#) specifies that # bootstrap replicate-weight variables were used to generate each bootstrap
mean-weight variable specified in the bsrweight() option of svyset. The bsn() option of
bootstrap overrides the bsn() option of svyset; see [SVY] svyset.
saving(), verbose, noisily, trace, title(), nodrop, reject(); see [SVY] svy bootstrap.
Also see
[SVY] svy — The survey prefix command
[SVY] svy bootstrap — Bootstrap for survey data
23
Title
brr options — More options for BRR variance estimation
Syntax
brr options Description
SE
mse use MSE formula for variance
nodots suppress replication dots
hadamard(matrix) Hadamard matrix
fay(#) Fay’s adjustment
saving( filename, . . .) save results to filename
verbose display the full table legend
noisily display any output from command
trace trace command
title(text) use text as the title for results
nodrop do not drop observations
reject(exp) identify invalid results
saving(), verbose, noisily, trace, title(), nodrop, and reject() are not shown in the dialog boxes for
estimation commands.
Options
SE
mse specifies that svy compute the variance by using deviations of the replicates from the observed
value of the statistics based on the entire dataset. By default, svy computes the variance by using
deviations of the replicates from their mean.
nodots suppresses display of the replication dots. By default, one dot character is printed for each
successful replication. A red ‘x’ is displayed if command returns with an error, and ‘e’ is displayed
if at least one of the values in the exp list is missing.
hadamard(matrix) specifies the Hadamard matrix to be used to determine which PSUs are chosen
for each replicate.
fay(#) specifies Fay’s adjustment. This option overrides the fay(#) option of svyset; see [SVY] svy-
set.
saving(), verbose, noisily, trace, title(), nodrop, reject(); see [SVY] svy brr.
Also see
[SVY] svy — The survey prefix command
[SVY] svy brr — Balanced repeated replication for survey data
24
Title
direct standardization — Direct standardization of means, proportions, and ratios
Description
Direct standardization is an estimation method that allows comparing rates that come from
different frequency distributions. The mean, proportion, and ratio commands can estimate means,
proportions, and ratios by using direct standardization.
See [SVY] poststratification for a similar estimation method given population sizes for strata not
used in the sampling design.
25
26 direct standardization — Direct standardization of means, proportions, and ratios
. use http://www.stata-press.com/data/r14/stdize
. list, noobs sep(0) sum
We can use svy: ratio to compute the death rates for each district in 1840. Because this
dataset is identified as census data, we will create an FPC variable that will contain a sampling
rate of 100%. This method will result in zero standard errors, which are interpreted to mean no
variability—appropriate because our point estimates came from the entire population.
. gen fpc = 1
. svyset, fpc(fpc)
pweight: <none>
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: fpc
. svy: ratio (Bethnal: bgdeaths/bgliving) (Hanover: hsdeaths/hsliving)
(running ratio on estimation sample)
Survey: Ratio estimation
Number of strata = 1 Number of obs = 21
Number of PSUs = 21 Population size = 21
Design df = 20
Bethnal: bgdeaths/bgliving
Hanover: hsdeaths/hsliving
Linearized
Ratio Std. Err. [95% Conf. Interval]
Bethnal .0238095 0 . .
Hanover .0213384 0 . .
The death rates are 2.38% for Bethnal Green and 2.13% for St. George’s Hanover Square. These
observed death rates are not really comparable because they come from two different age distributions.
We can standardize based on the age distribution from Bethnal Green. Here age identifies our standard
strata and bgliving contains the associated population sizes.
. svy: ratio (Bethnal: bgdeaths/bgliving) (Hanover: hsdeaths/hsliving),
> stdize(age) stdweight(bgliving)
(running ratio on estimation sample)
Survey: Ratio estimation
Number of strata = 1 Number of obs = 21
Number of PSUs = 21 Population size = 21
N. of std strata = 21 Design df = 20
Bethnal: bgdeaths/bgliving
Hanover: hsdeaths/hsliving
Linearized
Ratio Std. Err. [95% Conf. Interval]
Bethnal .0238095 0 . .
Hanover .0266409 0 . .
The standardized death rate for St. George’s Hanover Square, 2.66%, is larger than the death rate
for Bethnal Green.
For this example, we could have used dstdize to compute the death rates; however, dstdize will
not compute the correct standard errors for survey data. Furthermore, dstdize is not an estimation
command, so test and the other postestimation commands are not available.
Technical note
The values in the variable supplied to the stdweight() option are normalized so that (1) is true;
see Methods and formulas. Thus the stdweight() variable can contain either population sizes or
population proportions for the associated standard strata.
Also let LD be the number of standard strata, and let πg be the proportion of the population that
belongs to standard stratum g .
LD
X
πg = 1 (1)
g=1
In subpopulation estimation, πg is set to zero if none of the individuals in standard stratum g are in
the subpopulation. Then the standard stratum proportions are renormalized.
Let yj and xj be the items of interest and wj be the sampling weight for the j th sampled individual.
The estimator for the standardized ratio of R = Y /X is
LD
bD =
X Ybg
R πg
g=1 Xbg
where
m
X
Ybg = IDg (j) wj yj
j=1
with X
bg similarly defined.
For replication-based variance estimation, replicates of the standardized values are used in the
variance formulas.
The score variable for the linearized variance estimator of the standardized ratio is
LD bg yj − Ybg xj
bD ) =
X X
zj (R πg IDg (j)
Xb2
g=1 g
This score variable was derived using the method described in [SVY] variance estimation and is a
direct result of the methods described in Deville (1999), Demnati and Rao (2004), and Shah (2004).
For the mean and proportion commands, the mean estimator is a ratio estimator with the
denominator variable equal to one (xj = 1) and the proportion estimator is the mean estimator with
an indicator variable in the numerator (yj ∈ {0, 1}).
References
Demnati, A., and J. N. K. Rao. 2004. Linearization variance estimators for survey data. Survey Methodology 30:
17–26.
Deville, J.-C. 1999. Variance estimation for complex statistics and estimators: Linearization and residual techniques.
Survey Methodology 25: 193–203.
Korn, E. L., and B. I. Graubard. 1999. Analysis of Health Surveys. New York: Wiley.
Shah, B. V. 2004. Comment [on Demnati and Rao (2004)]. Survey Methodology 30: 29.
Also see
[SVY] svy — The survey prefix command
[SVY] svyset — Declare survey design for dataset
[SVY] poststratification — Poststratification for survey data
[SVY] survey — Introduction to survey commands
Title
estat — Postestimation statistics for survey data
Description
estat svyset reports the survey design characteristics associated with the current estimation
results.
estat effects displays a table of design and misspecification effects for each estimated parameter.
estat lceffects displays a table of design and misspecification effects for a user-specified linear
combination of the parameter estimates.
estat size displays a table of sample and subpopulation sizes for each estimated subpopulation
mean, proportion, ratio, or total. This command is available only after svy: mean, svy: proportion,
svy: ratio, and svy: total; see [R] mean, [R] proportion, [R] ratio, and [R] total.
estat sd reports subpopulation standard deviations based on the estimation results from mean
and svy: mean; see [R] mean. estat sd is not appropriate with estimation results that used direct
standardization or poststratification.
estat strata displays a table of the number of singleton and certainty strata within each
sampling stage. The variance scaling factors are also displayed for estimation results where
singleunit(scaled) was svyset.
estat cv reports the coefficient of variation (CV) for each coefficient in the current estimation
results. The CV for coefficient b is
SE(b)
CV(b) = × 100%
|b|
estat gof reports a goodness-of-fit test for binary response models using survey data. This
command is available only after svy: logistic, svy: logit, and svy: probit; see [R] logistic,
[R] logit, and [R] probit.
estat vce displays the covariance or correlation matrix of the parameter estimates of the previous
model. See [R] estat vce for examples.
Quick start
Design effects for each parameter in current estimation results after a command using the svy: prefix
estat effects
Design effects for the sum of parameter estimates for variables v1 and v2
estat lceffects v1 + v2
As above, but add misspecification effects
estat lceffects v1 + v2, deff deft meff meft
29
30 estat — Postestimation statistics for survey data
Menu
Statistics > Survey data analysis > DEFF, MEFF, and other statistics
estat — Postestimation statistics for survey data 31
Syntax
Survey design characteristics
estat svyset
Subpopulation sizes
estat size , estat size options
Options
Options are presented under the following headings:
Options for estat effects
Options for estat lceffects
Options for estat size
Options for estat sd
Options for estat cv
Options for estat gof
Options for estat vce
Linearized
Mean Std. Err. [95% Conf. Interval]
We can use estat svyset to remind us of the survey design characteristics that were used to
produce these results.
. estat svyset
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: strata
SU 1: psu
FPC 1: <zero>
estat effects reports a table of design and misspecification effects for each mean we estimated.
. estat effects, deff deft meff meft
Linearized
Mean Std. Err. DEFF DEFT MEFF MEFT
estat size reports a table that contains sample and population sizes.
. estat size
Linearized
Mean Std. Err. Obs Size
Linearized
Over Mean Std. Err. Obs Size
tcresult
Male 210.7937 1.312967 4,915 56,159,480
Female 215.2188 1.193853 5,436 60,998,033
tcresult
Male 210.7937 45.79065
Female 215.2188 50.72563
Linearized
Over Mean Std. Err. CV (%)
tcresult
Male 210.7937 1.312967 .622868
Female 215.2188 1.193853 .554716
Linearized
Over Mean Std. Err. DEFF DEFT
iron
Male 104.7969 .557267 1.36097 1.16661
Female 97.16247 .6743344 2.01403 1.41916
Thus the design-based variance estimate is about 36% larger than the estimate from the hypothetical
SRS design including the full population. We can get DEFF and DEFT for the alternate SRS design by
using the srssubpop option.
. estat effects, srssubpop
Male: sex = Male
Female: sex = Female
Linearized
Over Mean Std. Err. DEFF DEFT
iron
Male 104.7969 .557267 1.348 1.16104
Female 97.16247 .6743344 2.03132 1.42524
Because the NHANES II did not stratify on sex, we think it problematic to consider design effects
with respect to SRS of the female (or male) subpopulation. Consequently, we would prefer to use the
default here, although the values of DEFF differ little between the two in this case.
For other examples (generally involving heavy oversampling or undersampling of specified sub-
populations), the differences in DEFF for the two schemes can be much more dramatic.
38 estat — Postestimation statistics for survey data
Consider the NMIHS data (Gonzalez, Krauss, and Scott 1992), and compute the mean of birthwgt
over race:
. use http://www.stata-press.com/data/r14/nmihs
. svy: mean birthwgt, over(race)
(output omitted )
. estat effects
nonblack: race = nonblack
black: race = black
Linearized
Over Mean Std. Err. DEFF DEFT
birthwgt
nonblack 3402.32 7.609532 1.44376 1.20157
black 3127.834 6.529814 .172041 .414778
Linearized
Over Mean Std. Err. DEFF DEFT
birthwgt
nonblack 3402.32 7.609532 .826842 .909308
black 3127.834 6.529814 .528963 .727298
Because the NMIHS survey was stratified on race, marital status, age, and birthweight, we believe it
reasonable to consider design effects computed with respect to SRS within an individual race group.
Consequently, we would recommend here the alternative hypothetical design for computing design
effects; that is, we would use the srssubpop option.
MEFF = Vb /Vbmsp
√
MEFT = MEFF
where Vb is the appropriate design-based estimate of variance and Vbmsp is the variance estimate
computed with a misspecified design—ignoring the sampling weights, stratification, and clustering.
Here we request that the misspecification effects be displayed for the estimation of mean zinc
levels from our NHANES II data.
. use http://www.stata-press.com/data/r14/nhanes2b
. svy: mean zinc, over(sex)
(output omitted )
. estat effects, meff meft
Male: sex = Male
Female: sex = Female
Linearized
Over Mean Std. Err. MEFF MEFT
zinc
Male 90.74543 .5850741 6.28254 2.5065
Female 83.8635 .4689532 6.32648 2.51525
If we run ci without weights, we get the standard errors that are (Vbmsp )1/2 .
. sort sex
. ci zinc if sex == "Male":sex
Variable Obs Mean Std. Err. [95% Conf. Interval]
Linearized
Over Mean Std. Err. [95% Conf. Interval]
tcresult
Male 210.7937 1.312967 208.1159 213.4715
Female 215.2188 1.193853 212.784 217.6537
We can use estat lceffects to report the standard error, design effects, and misspecification effects
of the difference between the above means.
. estat lceffects [tcresult]Male - [tcresult]Female, deff deft meff meft
( 1) [tcresult]Male - [tcresult]Female = 0
Nh σ h
nh = n PL (1)
i=1 Ni σi
We can use estat sd with our current survey data to produce a table of subpopulation standard-
deviation estimates. Then we could plug these estimates into (1) to improve our survey design for
the next time we sample from our population.
estat — Postestimation statistics for survey data 41
Here is an example using birthweight from the NMIHS data. First, we need estimation results from
svy: mean over the strata.
. use http://www.stata-press.com/data/r14/nmihs
. svyset [pw=finwgt], strata(stratan)
pweight: finwgt
VCE: linearized
Single unit: missing
Strata 1: stratan
SU 1: <observations>
FPC 1: <zero>
. svy: mean birthwgt, over(stratan)
(output omitted )
Next we will use estat size to report the table of stratum sizes. We will also generate matrix
p obs to contain the observed percent allocations for each stratum. In the matrix expression, r( N)
is a row vector of stratum sample sizes and e(N) contains the total sample size. r( N subp) is a
row vector of the estimated population stratum sizes.
. estat size
1: stratan = 1
2: stratan = 2
3: stratan = 3
4: stratan = 4
5: stratan = 5
6: stratan = 6
Linearized
Over Mean Std. Err. Obs Size
birthwgt
1 1049.434 19.00149 841 18,402.98161
2 2189.561 9.162736 803 67,650.95932
3 3303.492 7.38429 3,578 579,104.6188
4 1036.626 12.32294 710 29,814.93215
5 2211.217 9.864682 714 153,379.07445
6 3485.42 8.057648 3,300 3,047,209.105
Now we call estat sd to report the stratum standard-deviation estimates and generate matrix
p neyman to contain the percent allocations according to (1). In the matrix expression, r(sd) is a
vector of the stratum standard deviations.
42 estat — Postestimation statistics for survey data
. estat sd
1: stratan = 1
2: stratan = 2
3: stratan = 3
4: stratan = 4
5: stratan = 5
6: stratan = 6
birthwgt
1 1049.434 2305.931
2 2189.561 555.7971
3 3303.492 687.3575
4 1036.626 999.0867
5 2211.217 349.8068
6 3485.42 300.6945
We can see that strata 3 and 6 each contain about one-third of the observed data, with the rest of
the observations spread out roughly equally to the remaining strata. However, plugging our sample
estimates into (1) indicates that stratum 6 should get 62% of the sampling units, stratum 3 should
get about 27%, and the remaining strata should get a roughly equal distribution of sampling units.
. use http://www.stata-press.com/data/r14/strata5
. svy: total y
(output omitted )
. estat strata
1 0 1 4
2 1 0 10
3 0 3 29
4 2 0 110
5 204 311 865
estat strata also reports the scale factor used when the singleunit(scaled) option is
svyset. Of the 865 strata in the last stage, 204 are singleton strata and 311 are certainty strata. Thus
the scaling factor for the last stage is
865 − 311
≈ 1.58
865 − 311 − 204
1 0 1 4 1
2 1 0 10 1.11
3 0 3 29 1
4 2 0 110 1.02
5 204 311 865 1.58
The singleunit(scaled) option of svyset is one of three methods in which Stata’s svy commands
can automatically handle singleton strata when performing variance estimation; see [SVY] variance
estimation for a brief discussion of these methods.
44 estat — Postestimation statistics for survey data
Linearized
highbp Odds Ratio Std. Err. t P>|t| [95% Conf. Interval]
We can use estat gof to perform a goodness-of-fit test for this model.
. estat gof
Logistic model for highbp, goodness-of-fit test
F(9,23) = 5.32
Prob > F = 0.0006
The F statistic is significant at the 5% level, indicating that the model is not a good fit for these data.
estat — Postestimation statistics for survey data 45
Stored results
estat svyset stores the following in r():
Scalars
r(stages) number of sampling stages
r(stages wt) last stage containing stage-level weights
Macros
r(wtype) weight type
r(wexp) weight expression
r(wvar) weight variable name
r(weight#) variable identifying weight for stage #
r(su#) variable identifying sampling units for stage #
r(strata#) variable identifying strata for stage #
r(fpc#) FPC for stage #
r(bsrweight) bsrweight() variable list
r(bsn) bootstrap mean-weight adjustment
r(brrweight) brrweight() variable list
r(fay) Fay’s adjustment
r(jkrweight) jkrweight() variable list
r(sdrweight) sdrweight() variable list
r(sdrfpc) fpc() value from within sdrweight()
r(vce) vcetype specified in vce()
r(dof) dof() value
r(mse) mse, if specified
r(poststrata) poststrata() variable
r(postweight) postweight() variable
r(settings) svyset arguments to reproduce the current settings
r(singleunit) singleunit() setting
Design effects
estat effects produces two estimators of design effect, DEFF and DEFT.
DEFF is estimated as described in Kish (1965) as
Vb (θ)
b
DEFF =
Vbsrswor (θesrs )
estat — Postestimation statistics for survey data 47
where Vb (θ)
b is the design-based estimate of variance for a parameter, θ, and Vbsrswor (θesrs ) is an
estimate of the variance for an estimator, θesrs , that would be obtained from a similar hypothetical
survey conducted using SRS without replacement (wor) and with the same number of sample elements,
m, as in the actual survey. For example, if θ is a total Y , then
m
M
c X 2
Vbsrswor (θesrs ) = (1 − f ) wj yj − Yb (1)
m − 1 j=1
where Yb = Yb /M c. The factor (1 − f ) is a finite population correction. If the user sets an FPC for
the first stage, f = m/Mc is used; otherwise, f = 0.
DEFT is estimated as described in Kish (1987, 41) as
s
Vb (θ)
b
DEFT =
Vbsrswr (θesrs )
where Vbsrswr (θesrs ) is an estimate of the variance for an estimator, θesrs , obtained from a similar survey
conducted using SRS with replacement (wr). Vbsrswr (θesrs ) is computed using (1) with f = 0.
When computing estimates for a subpopulation, S , and the srssubpop option is not specified
(that is, the default), (1) is used with wSj = IS (j) wj in place of wj , where
(
1, if j ∈ S
IS (j) =
0, otherwise
The sums in (1) are still calculated over all elements in the sample, regardless of whether they belong
to the subpopulation: by default, the SRS is assumed to be done across the full population.
When the srssubpop option is specified, the SRS is carried out within subpopulation S . Here
(1) is used with the sums restricted to those elements belonging to the subpopulation; m is replaced
with mS , the number of sample elements from the subpopulation; M c is replaced with M
cS , the sum
of the weights from the subpopulation; and Y is replaced with Y = Y /M , the weighted mean
b b b S
c S S
across the subpopulation.
Linear combinations
estat lceffects estimates η = Cθ, where θ is a q × 1 vector of parameters (for example,
population means or population regression coefficients) and C is any 1 × q vector of constants. The
estimate of η is ηb = C θb, and its variance estimate is
Vb (b b 0
η ) = C Vb (θ)C
Similarly, the SRS without replacement (srswor) variance estimator used in the computation of DEFF
is
and the SRS with replacement (srswr) variance estimator used in the computation of DEFT is
estat lceffects was originally developed under a different command name; see Eltinge and
Sribney (1996b).
Misspecification effects
estat effects produces two estimators of misspecification effect, MEFF and MEFT.
Vb (θ)
b
MEFF =
Vbmsp (θbmsp )
√
MEFT = MEFF
where Vb (θ)
b is the design-based estimate of variance for a parameter, θ, and Vbmsp (θbmsp ) is the variance
estimate for θbmsp . These estimators, θbmsp and Vbmsp (θbmsp ), are based on the incorrect assumption
that the observations were obtained through SRS with replacement: they are the estimators obtained
by simply ignoring weights, stratification, and clustering. When θ is a total Y , the estimator and its
variance estimate are computed using the standard formulas for an unweighted total:
m
cy = M
cX
Ybmsp = M yj
m j=1
c2 m
M X 2
Vbmsp (Ybmsp ) = yj − y
m(m − 1) j=1
When computing MEFF and MEFT for a subpopulation, sums are restricted to those elements
belonging to the subpopulation, and mS and M
cS are used in place of m and M
c.
Coefficient of variation
The coefficient of variation (CV) for estimate θb is
q
Vb (θ)
b
CV(θ)
b = × 100%
|θ|
b
b 2 = r{Vb (r)}−1 r0
X
b 2 is approximately distributed as a
where Vb (r) is the design-based variance estimate for r. Here X
χ2 with g − 1 degrees of freedom. This Wald statistic is one of the three goodness-of-fit statistics
discussed in Graubard, Korn, and Midthune (1997). estat gof reports this statistic when the design
degrees of freedom is missing, such as with svy bootstrap results.
According to Archer and Lemeshow (2006), the F -adjusted mean residual test is given by
b 2 (d − g + 2)/(dg)
Fb = X
References
Archer, K. J., and S. A. Lemeshow. 2006. Goodness-of-fit test for a logistic regression model fitted using survey
sample data. Stata Journal 6: 97–105.
Cochran, W. G. 1977. Sampling Techniques. 3rd ed. New York: Wiley.
Eltinge, J. L., and W. M. Sribney. 1996a. Accounting for point-estimation bias in assessment of misspecification
effects, confidence-set coverage rates and test sizes. Unpublished manuscript, Department of Statistics, Texas A&M
University.
. 1996b. svy5: Estimates of linear combinations and hypothesis tests for survey data. Stata Technical Bulletin
31: 31–42. Reprinted in Stata Technical Bulletin Reprints, vol. 6, pp. 246–259. College Station, TX: Stata Press.
Gonzalez, J. F., Jr., N. Krauss, and C. Scott. 1992. Estimation in the 1988 National Maternal and Infant Health
Survey. Proceedings of the Section on Statistics Education, American Statistical Association 343–348.
Graubard, B. I., E. L. Korn, and D. Midthune. 1997. Testing goodness-of-fit for logistic regression with survey data.
In Proceedings of the Section on Survey Research Methods, Joint Statistical Meetings, 170–174. Alexandria, VA:
American Statistical Association.
Kish, L. 1965. Survey Sampling. New York: Wiley.
50 estat — Postestimation statistics for survey data
Also see
[SVY] svy postestimation — Postestimation tools for svy
[SVY] svy estimation — Estimation commands for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
Title
jackknife options — More options for jackknife variance estimation
Description
svy accepts more options when performing jackknife variance estimation.
Syntax
jackknife options Description
SE
mse use MSE formula for variance
nodots suppress replication dots
saving( filename, . . .) save results to filename
keep keep pseudovalues
verbose display the full table legend
noisily display any output from command
trace trace command
title(text) use text as the title for results
nodrop do not drop observations
reject(exp) identify invalid results
saving(), keep, verbose, noisily, trace, title(), nodrop, and reject() are not shown in the dialog boxes
for estimation commands.
Options
SE
mse specifies that svy compute the variance by using deviations of the replicates from the observed
value of the statistic based on the entire dataset. By default, svy computes the variance by using
deviations of the pseudovalues from their mean.
nodots suppresses display of the replication dots. By default, one dot character is printed for each
successful replication. A red ‘x’ is displayed if command returns with an error, ‘e’ is displayed
if at least one of the values in the exp list is missing, ‘n’ is displayed if the sample size is not
correct, and a yellow ‘s’ is displayed if the dropped sampling unit is outside the subpopulation
sample.
saving(), keep, verbose, noisily, trace, title(), nodrop, reject(); see [SVY] svy jackknife.
Also see
[SVY] svy — The survey prefix command
[SVY] svy jackknife — Jackknife estimation for survey data
51
Title
ml for svy — Maximum pseudolikelihood estimation for survey data
Here we fit a survey regression model using a multistage survey dataset with ml and the above
likelihood evaluator.
. use http://www.stata-press.com/data/r14/multistage
. svyset county [pw=sampwgt], strata(state) fpc(ncounties) || school,
> fpc(nschools)
pweight: sampwgt
VCE: linearized
Single unit: missing
Strata 1: state
SU 1: county
FPC 1: ncounties
Strata 2: <one>
SU 2: school
FPC 2: nschools
. ml model lf mynormal_lf (mu: weight = height) /lnsigma, svy
52
ml for svy — Maximum pseudolikelihood estimation for survey data 53
. ml max
initial: log pseudolikelihood = -<inf> (could not be evaluated)
feasible: log pseudolikelihood = -7.301e+08
rescale: log pseudolikelihood = -51944380
rescale eq: log pseudolikelihood = -47565331
Iteration 0: log pseudolikelihood = -47565331
Iteration 1: log pseudolikelihood = -41226725 (not concave)
Iteration 2: log pseudolikelihood = -41221650 (not concave)
Iteration 3: log pseudolikelihood = -41176159 (not concave)
Iteration 4: log pseudolikelihood = -41154139 (not concave)
Iteration 5: log pseudolikelihood = -41052368
Iteration 6: log pseudolikelihood = -39379181 (backed up)
Iteration 7: log pseudolikelihood = -38333242
Iteration 8: log pseudolikelihood = -38328742
Iteration 9: log pseudolikelihood = -38328739
Number of strata = 50 Number of obs = 4,071
Number of PSUs = 100 Population size = 8,000,000
Design df = 50
F( 1, 50) = 593.99
Prob > F = 0.0000
Linearized
weight Coef. Std. Err. t P>|t| [95% Conf. Interval]
mu
height .716311 .0293908 24.37 0.000 .6572778 .7753442
_cons -149.6181 12.57266 -11.90 0.000 -174.871 -124.3652
lnsigma
_cons 3.372153 .0180777 186.54 0.000 3.335843 3.408464
Reference
Gould, W. W., J. S. Pitblado, and B. P. Poi. 2010. Maximum Likelihood Estimation with Stata. 4th ed. College
Station, TX: Stata Press.
Also see
[P] program properties — Properties of user-defined programs
[R] maximize — Details of iterative maximization
[R] ml — Maximum likelihood estimation
[SVY] survey — Introduction to survey commands
Title
poststratification — Poststratification for survey data
Description
Poststratification is a method for adjusting the sampling weights, usually to account for underrep-
resented groups in the population.
See [SVY] direct standardization for a similar method of adjustment that allows the comparison
of rates that come from different frequency distributions.
Overview
Poststratification involves adjusting the sampling weights so that they sum to the population
sizes within each poststratum. This usually results in decreasing bias because of nonresponse and
underrepresented groups in the population. Poststratification also tends to result in smaller variance
estimates.
The svyset command has options to set variables for applying poststratification adjustments to the
sampling weights. The poststrata() option takes a variable that contains poststratum identifiers,
and the postweight() option takes a variable that contains the poststratum population sizes.
In the following example, we use an example from Levy and Lemeshow (2008) to show how
poststratification affects the point estimates and their variance.
54
poststratification — Poststratification for survey data 55
Linearized
Mean Std. Err. [95% Conf. Interval]
The mean total expenses is $40.12 with a standard error of $1.16. In the following, we omit the
poststratification information from svyset, resulting in mean total expenses of $39.73 with standard
error $2.22. The difference between the mean estimates is explained by the facts that expenses tend
to be larger for dogs than for cats and that the dogs were slightly underrepresented in the sample
(850/1,300 ≈ 0.65 for the population; 32/50 = 0.64 for the sample). This reasoning also explains why
the variance estimate from the poststratified mean is smaller than the one that was not poststratified.
. svyset, fpc(fpc)
pweight: <none>
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: fpc
. svy: mean totexp
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 1 Number of obs = 50
Number of PSUs = 50 Population size = 50
Design df = 49
Linearized
Mean Std. Err. [95% Conf. Interval]
Video example
Specifying the poststratification of survey data to Stata
If wj is the unadjusted sampling weight for the j th sampled individual, the poststratification
adjusted sampling weight is
LP
X Mk
wj∗ = IPk (j) w
ck j
M
k=1
where M
ck is
m
X
M
ck = IPk (j)wj
j=1
The point estimates are computed using these adjusted weights. For example, the poststratified total
estimator is
Xm
Yb P = wj∗ yj
j=1
LP
!
bP
X Mk Ybk
zj (Y ) = IPk (j) yj − (1)
k=1 M
ck M
ck
bP bP bP bP
bP ) = X zj (Y ) − Y zj (X )
zj ( R (2)
b P )2
(X
where Xb P is the poststratified total estimator for item xj . For regression models, the equation-level
scores are adjusted as in (1). These score variables were derived using the method described in
[SVY] variance estimation for the ratio estimator and are a direct result of the methods described in
Deville (1999), Demnati and Rao (2004), and Shah (2004).
References
Demnati, A., and J. N. K. Rao. 2004. Linearization variance estimators for survey data. Survey Methodology 30:
17–26.
Deville, J.-C. 1999. Variance estimation for complex statistics and estimators: Linearization and residual techniques.
Survey Methodology 25: 193–203.
Levy, P. S., and S. A. Lemeshow. 2008. Sampling of Populations: Methods and Applications. 4th ed. Hoboken, NJ:
Wiley.
Shah, B. V. 2004. Comment [on Demnati and Rao (2004)]. Survey Methodology 30: 29.
poststratification — Poststratification for survey data 57
Also see
[SVY] svy — The survey prefix command
[SVY] svyset — Declare survey design for dataset
[SVY] survey — Introduction to survey commands
Title
sdr options — More options for SDR variance estimation
Description
svy accepts more options when performing successive difference replication (SDR) variance
estimation. See [SVY] svy sdr for a complete discussion.
Syntax
sdr options Description
SE
mse use MSE formula for variance
nodots suppress replication dots
saving( filename, . . .) save results to filename
verbose display the full table legend
noisily display any output from command
trace trace command
title(text) use text as the title for results
nodrop do not drop observations
reject(exp) identify invalid results
saving(), verbose, noisily, trace, title(), nodrop, and reject() are not shown in the dialog boxes for
estimation commands.
Options
SE
mse specifies that svy compute the variance by using deviations of the replicates from the observed
value of the statistics based on the entire dataset. By default, svy computes the variance by using
deviations of the replicates from their mean.
nodots suppresses display of the replication dots. By default, one dot character is printed for each
successful replication. A red ‘x’ is displayed if command returns with an error, and ‘e’ is displayed
if at least one of the values in the exp list is missing.
saving(), verbose, noisily, trace, title(), nodrop, reject(); see [SVY] svy sdr.
Also see
[SVY] svy — The survey prefix command
[SVY] svy sdr — Successive difference replication for survey data
58
Title
subpopulation estimation — Subpopulation estimation for survey data
Description
Subpopulation estimation focuses on part of the population. This entry discusses subpopulation
estimation and explains why you should use the subpop() option instead of if and in for your
survey data analysis.
Example 1
Suppose that we are interested in estimating the proportion of women in our population who have
had a heart attack. In our NHANES II dataset (McDowell et al. 1981), the female participants can
be identified using the female variable, and the heartatk variable indicates whether an individual
has ever had a heart attack. Below we use svy: mean with the heartatk variable to estimate the
proportion of individuals who have had a heart attack, and we use subpop(female) to identify our
subpopulation of interest.
. use http://www.stata-press.com/data/r14/nhanes2d
. svy, subpop(female): mean heartatk
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 31 Number of obs = 10,349
Number of PSUs = 62 Population size = 117,131,111
Subpop. no. obs = 5,434
Subpop. size = 60,971,631
Design df = 31
Linearized
Mean Std. Err. [95% Conf. Interval]
59
60 subpopulation estimation — Subpopulation estimation for survey data
The subpop(varname) option takes a 0/1 variable, and the subpopulation of interest is defined by
varname = 1. All other members of the sample not in the subpopulation are indicated by varname = 0.
If a person’s subpopulation status is unknown, varname should be set to missing (.), so those
observations will be omitted from the analysis. For instance, in the preceding analysis, if a person’s
sex was not recorded, female should be coded as missing rather than as male (female = 0).
Technical note
Actually, the subpop(varname) option takes a zero/nonzero variable, and the subpopulation is
defined by varname 6= 0 and not missing. All other members of the sample not in the subpopulation
are indicated by varname = 0, but 0, 1, and missing are typically the only values used for the
subpop() variable.
Furthermore, you can specify an if qualifier within subpop() to identify a subpopulation. The
result is the same as generating a variable equal to the conditional expression and supplying it as the
subpop() variable. If a varname and an if qualifier are specified within the subpop() option, the
subpopulation is identified by their logical conjunction (logical and ), and observations with missing
values in either are dropped from the estimation sample.
Linearized
Over Mean Std. Err. [95% Conf. Interval]
birthwgt
nonblack 3402.32 7.609532 3387.404 3417.236
black 3127.834 6.529814 3115.035 3140.634
subpopulation estimation — Subpopulation estimation for survey data 61
Linearized
Over Mean Std. Err. [95% Conf. Interval]
birthwgt
_subpop_1 3291.045 20.18795 3251.472 3330.617
_subpop_2 3426.407 8.379497 3409.982 3442.833
_subpop_3 3073.122 8.752553 3055.965 3090.279
_subpop_4 3221.616 12.42687 3197.257 3245.975
Here the race and marital variables have value labels. race has the value 0 labeled “nonblack”
(that is, white and other) and 1 labeled “black”; marital has the value 0 labeled “single” and 1
labeled “married”. Value labels on the over() variables make for a more informative legend above
the table of point estimates. See [U] 12.6.3 Value labels for information on creating value labels.
We can also combine the subpop() option with the over() option.
. generate nonblack = (race == 0) if !missing(race)
. svy, subpop(nonblack): mean birthwgt, over(marital age20)
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 3 Number of obs = 4,724
Number of PSUs = 4,724 Population size = 3,230,403
Subpop. no. obs = 4,724
Subpop. size = 3,230,403
Design df = 4,721
Over: marital age20
_subpop_1: single age20+
_subpop_2: single age<20
_subpop_3: married age20+
_subpop_4: married age<20
Linearized
Over Mean Std. Err. [95% Conf. Interval]
birthwgt
_subpop_1 3312.012 24.2869 3264.398 3359.625
_subpop_2 3244.709 36.85934 3172.448 3316.971
_subpop_3 3434.923 8.674633 3417.916 3451.929
_subpop_4 3287.301 34.15988 3220.332 3354.271
This time, we estimated means for the marital status and age (<20 or ≥20) subpopulations for race
== 0 (nonblack) only. We carefully define nonblack so that it is missing when race is missing.
62 subpopulation estimation — Subpopulation estimation for survey data
Subpopulation totals
Let Yj be a survey item for individual j in the population, where j = 1, . . . , N and N is the
population size. Let S be a subset of individuals in the population and IS (j) indicate if the j th
individual is in S , where (
1, if j ∈ S
IS (j) =
0, otherwise
The subpopulation total is
N
X
YS = IS (j)Yj
j=1
and the subpopulation size is
N
X
NS = IS (j)
j=1
Let yj be the items for those individuals selected in the sample, where j = 1, . . . , n and n is the
sample size. The number of individuals sampled from the subpopulation is
X n
nS = IS (j)
j=1
The estimator for the subpopulation total is
n
X
YbS = IS (j)wj yj (1)
j=1
subpopulation estimation — Subpopulation estimation for survey data 63
where wj = N/n is the unadjusted sampling weight for this design. The estimator for NS is
n
X
NbS = IS (j)wj
j=1
The replicate values for the BRR and jackknife variance estimators are computed using the same
method.
The linearized variance estimator for YbS is
n 2
n n X 1
Vb (YbS ) = 1 − IS (j)wj yj − YbS (2)
N n−1 j=1
n
Equation (2) is not the same formula that results from restricting the estimation sample to
the observations within S . The formula using this restricted sample (assuming a svyset with the
corresponding FPC) is
n 2
nS nS X 1 b
V (YS ) = 1 −
e b IS (j) wj yj − YS (4)
NbS nS − 1 nS
j=1
These variance estimators, (2) and (4), assume two different survey designs. In (2), n individuals are
sampled without replacement from the population comprising the NS values from the subpopulation
with N − NS additional zeros. In (4), nS individuals are sampled without replacement from the
subpopulation of NS values. We discourage using (4) by warning against using the if and in
qualifiers for subpopulation estimation because this variance estimator does not accurately measure
the sample-to-sample variability of the subpopulation estimates for the survey design that was used
to collect the data.
For survey data, there are only a few circumstances that require using the if qualifier. For example,
if you suspected laboratory error for a certain set of measurements, then using the if qualifier to
omit these observations from the analysis might be proper.
References
Cochran, W. G. 1977. Sampling Techniques. 3rd ed. New York: Wiley.
Gonzalez, J. F., Jr., N. Krauss, and C. Scott. 1992. Estimation in the 1988 National Maternal and Infant Health
Survey. Proceedings of the Section on Statistics Education, American Statistical Association 343–348.
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
West, B. T., P. A. Berglund, and S. G. Heeringa. 2008. A closer examination of subpopulation analysis of complex-sample
survey data. Stata Journal 8: 520–531.
Also see
[SVY] svy postestimation — Postestimation tools for svy
[SVY] svy — The survey prefix command
[SVY] svyset — Declare survey design for dataset
[SVY] survey — Introduction to survey commands
Title
svy — The survey prefix command
Description
svy fits statistical models for complex survey data by adjusting the results of a command for
survey settings identified by svyset. Any Stata estimation command listed in [SVY] svy estimation
may be used with svy. User-written commands that meet the requirements in [P] program properties
may also be used.
Quick start
Data for a two-stage design with sampling weight wvar1, strata defined by levels of svar, sampling
units are identified by su1, and second-stage clustering is defined by su2
svyset su1 [pweight=wvar1], strata(svar) || su2
Adjust linear regression for complex survey design settings specified in svyset
svy: regress . . .
As above, but restrict estimation to the subpopulation where group equals 4
svy, subpop(if group==4): regress . . .
Same as above, but use new binary variable insample to indicate the subpopulation
generate insample = (group==4)
svy, subpop(insample): regress . . .
Specify that the design degrees of freedom is 135 instead of the difference between the number of
unique values of su1 and the number of levels of svar
svy, dof(135): regress . . .
Note: Any estimation command meeting the requirements specified in the Description may be
substituted for regress in the examples above.
65
66 svy — The survey prefix command
Syntax
svy vcetype , svy options eform option : command
vcetype Description
SE
linearized Taylor-linearized variance estimation
bootstrap bootstrap variance estimation; see [SVY] svy bootstrap
brr BRR variance estimation; see [SVY] svy brr
jackknife jackknife variance estimation; see [SVY] svy jackknife
sdr SDR variance estimation; see [SVY] svy sdr
Specifying a vcetype overrides the default from svyset.
svy requires that the survey design variables be identified using svyset; see [SVY] svyset.
command defines the estimation command to be executed. The by prefix cannot be part of command.
mi estimate may be used with svy linearized if the estimation command allows mi estimate; it may not be
used with svy bootstrap, svy brr, svy jackknife, or svy sdr.
noheader, nolegend, noadjust, noisily, trace, and coeflegend are not shown in the dialog boxes for estimation
commands.
Warning: Using if or in restrictions will often not produce correct variance estimates for subpopulations. To compute
estimates for subpopulations, use the subpop() option.
See [U] 20 Estimation and postestimation commands for more capabilities of estimation commands.
Options
if/in
subpop(subpop) specifies that estimates be computed for the single subpopulation identified by
subpop, which is
varname if
Thus the subpopulation is defined by the observations for which varname 6= 0 that also meet
the if conditions. Typically, varname = 1 defines the subpopulation, and varname = 0 indicates
observations not belonging to the subpopulation. For observations whose subpopulation status is
uncertain, varname should be set to a missing value; such observations are dropped from the
estimation sample.
See [SVY] subpopulation estimation and [SVY] estat.
SE
dof(#) specifies the design degrees of freedom, overriding the default calculation, df = Npsu −Nstrata .
bootstrap options are other options that are allowed with bootstrap variance estimation specified by svy
bootstrap or specified as svyset using the vce(bootstrap) option; see [SVY] bootstrap options.
brr options are other options that are allowed with BRR variance estimation specified by svy brr or
specified as svyset using the vce(brr) option; see [SVY] brr options.
jackknife options are other options that are allowed with jackknife variance estimation specified by svy
jackknife or specified as svyset using the vce(jackknife) option; see [SVY] jackknife options.
sdr options are other options that are allowed with SDR variance estimation specified by svy sdr or
specified as svyset using the vce(sdr) option; see [SVY] sdr options.
Reporting
level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is
level(95) or as set by set level; see [U] 20.7 Specifying the width of confidence intervals.
nocnsreport; see [R] estimation options.
display options: noci, nopvalues, noomitted, vsquish, noemptycells, baselevels,
allbaselevels, nofvlabel, fvwrap(#), fvwrapon(style), cformat(% fmt), pformat(% fmt),
sformat(% fmt), and nolstretch; see [R] estimation options.
The following options are available with svy but are not shown in the dialog boxes:
noheader prevents the table header from being displayed. This option implies nolegend.
68 svy — The survey prefix command
nolegend prevents the table legend identifying the subpopulations from being displayed.
noadjust specifies that the model Wald test be carried out as W/k ∼ F (k, d), where W is the Wald
test statistic, k is the number of terms in the model excluding the constant term, d is the total
number of sampled PSUs minus the total number of strata, and F (k, d) is an F distribution with
k numerator degrees of freedom and d denominator degrees of freedom. By default, an adjusted
Wald test is conducted: (d − k + 1)W/(kd) ∼ F (k, d − k + 1).
See Korn and Graubard (1990) for a discussion of the Wald test and the adjustments thereof. Using
the noadjust option is not recommended.
noisily requests that any output from command be displayed.
trace causes a trace of the execution of command to be displayed.
coeflegend; see [R] estimation options.
The following option is usually available with svy at the time of estimation or on replay but is not
shown in all dialog boxes:
eform option; see [R] eform option.
Linearized
Mean Std. Err. [95% Conf. Interval]
If we ignore the survey design and use mean to estimate the mean, we get
. mean zinc
Mean estimation Number of obs = 9,189
The point estimate from the unweighted analysis is smaller by more than one standard error than
the proper design-based estimate. Also, design-based analysis produced a standard error that is 3.27
times larger than the standard error produced by our incorrect analysis.
Linearized
Mean Std. Err. [95% Conf. Interval]
This approach gives us the same point estimate as our design-based analysis, but the reported
standard error is less than one-half the design-based standard error. If we accounted only for clustering
and weights and ignored stratification in NHANES II, we would obtain the following analysis:
. svyset psuid [pweight=finalwgt]
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: psuid
FPC 1: <zero>
. svy: mean zinc
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 1 Number of obs = 9,189
Number of PSUs = 2 Population size = 104,176,071
Design df = 1
Linearized
Mean Std. Err. [95% Conf. Interval]
Here our standard error is about 50% larger than what we obtained in our proper design-based analysis.
Example 3
Let’s look at a regression. We model zinc on the basis of age, weight, sex, race, and rural or urban
residence. We compare a proper design-based analysis with an ordinary regression (which assumes
independent and identically distributed error).
svy — The survey prefix command 71
Linearized
zinc Coef. Std. Err. t P>|t| [95% Conf. Interval]
If we had improperly ignored our survey weights, stratification, and clustering (that is, if we had
used the usual Stata regress command), we would have obtained the following results:
. regress zinc age c.age#c.age weight female black orace rural
Source SS df MS Number of obs = 9,189
F(7, 9181) = 79.72
Model 110417.827 7 15773.9753 Prob > F = 0.0000
Residual 1816535.3 9,181 197.85811 R-squared = 0.0573
Adj R-squared = 0.0566
Total 1926953.13 9,188 209.724982 Root MSE = 14.066
The point estimates differ by 3% – 100%, and the standard errors for the proper designed-based analysis
are 30% – 110% larger. The differences are not as dramatic as we saw with the estimation of the
mean, but they are still substantial.
Stored results
svy stores the following in e():
Scalars
e(N) number of observations
e(N sub) subpopulation observations
e(N strata) number of strata
e(N strata omit) number of strata omitted
e(singleton) 1 if singleton strata, 0 otherwise
e(census) 1 if census data, 0 otherwise
e(F) model F statistic
e(df m) model degrees of freedom
e(df r) variance degrees of freedom
e(N pop) estimate of population size
e(N subpop) estimate of subpopulation size
e(N psu) number of sampled PSUs
e(stages) number of sampling stages
e(k eq) number of equations in e(b)
e(k aux) number of ancillary parameters
e(p) p-value
e(rank) rank of e(V)
Macros
e(prefix) svy
e(cmdname) command name from command
e(cmd) same as e(cmdname) or e(vce)
e(command) command
e(cmdline) command as typed
e(wtype) weight type
e(wexp) weight expression
e(weight#) variable identifying weight for stage #
e(wvar) weight variable name
e(singleunit) singleunit() setting
e(strata) strata() variable
e(strata#) variable identifying strata for stage #
e(psu) psu() variable
e(su#) variable identifying sampling units for stage #
e(fpc) fpc() variable
e(fpc#) FPC for stage #
e(title) title in estimation output
e(poststrata) poststrata() variable
e(postweight) postweight() variable
e(vce) vcetype specified in vce()
e(vcetype) title used to label Std. Err.
e(mse) mse, if specified
e(subpop) subpop from subpop()
e(adjust) noadjust, if specified
e(properties) b V
e(estat cmd) program used to implement estat
e(predict) program used to implement predict
e(marginsnotok) predictions disallowed by margins
e(marginswtype) weight type for margins
Matrices
e(b) estimates
e(V) design-based variance
e(V srs) simple-random-sampling-without-replacement variance, V
bsrswor
svy — The survey prefix command 73
svy also carries forward most of the results already in e() from command.
References
Korn, E. L., and B. I. Graubard. 1990. Simultaneous testing of regression coefficients with complex survey data: Use
of Bonferroni t statistics. American Statistician 44: 270–276.
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Also see
[SVY] svy estimation — Estimation commands for survey data
[SVY] svy postestimation — Postestimation tools for svy
[SVY] svy bootstrap — Bootstrap for survey data
[SVY] svy brr — Balanced repeated replication for survey data
[SVY] svy jackknife — Jackknife estimation for survey data
[SVY] svy sdr — Successive difference replication for survey data
[SVY] svyset — Declare survey design for dataset
[P] robust — Robust variance estimates
[U] 20 Estimation and postestimation commands
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
[P] program properties — Properties of user-defined programs
Title
svy bootstrap — Bootstrap for survey data
Description
svy bootstrap performs nonparametric bootstrap estimation of specified statistics (or expressions)
for a Stata command or a user-written command. The command is executed once for each replicate
using sampling weights that are adjusted according to the bootstrap methodology. Any Stata estimation
command listed in [SVY] svy estimation may be used with svy bootstrap. User-written commands
that meet the requirements in [P] program properties may also be used.
Quick start
Estimate population mean of v1 using bootstrap standard-error estimates and variables with prefix
rwvar as the bootstrap replicate weights
svyset, bsrweight(rwvar*)
svy bootstrap _b: mean v1
Same as above
svyset, bsrweight(rwvar*) vce(bootstrap)
svy: mean v1
As above, and specify that 3 replicates were used to calculate each bootstrap replicate weight
svy, bsn(3): mean v1
Bootstrap standard error of the difference between the means of v2 and v3 using either svyset
command above
svy bootstrap (_b[v2]-_b[v3]): mean v2 v3
As above, but name the result diff and save results from each replication to mydata.dta
svy bootstrap diff=(_b[v2]-_b[v3]), saving(mydata): mean v2 v3
Note: Any estimation command meeting the requirements specified in the Description may be
substituted for mean in the examples above.
Menu
Statistics > Survey data analysis > Resampling > Bootstrap estimation
74
svy bootstrap — Bootstrap for survey data 75
Syntax
svy bootstrap exp list , svy options bootstrap options eform option : command
svy options Description
if/in
subpop( varname if ) identify a subpopulation
Reporting
level(#) set confidence level; default is level(95)
noheader suppress table header
nolegend suppress table legend
noadjust do not adjust model Wald statistic
nocnsreport do not display constraints
display options control columns and column formats, row spacing, line width,
display of omitted variables and base and empty cells, and
factor-variable labeling
coeflegend display legend instead of statistics
coeflegend is not shown in the dialog boxes for estimation commands.
exp list specifies the statistics to be collected from the execution of command. exp list is required
unless command has the svyb program property, in which case exp list defaults to b; see [P] program
properties. The expressions in exp list are assumed to conform to the following:
exp list contains (name: elist)
elist
eexp
elist contains newvarname = (exp)
(exp)
eexp is specname
[eqno]specname
specname is b
b[]
se
se[]
eqno is ##
name
exp is a standard Stata expression; see [U] 13 Functions and expressions.
Distinguish between [ ], which are to be typed, and , which indicate optional arguments.
Options
svy options; see [SVY] svy.
Main
bsn(#) specifies that # bootstrap replicate-weight variables were used to generate each bootstrap
mean-weight variable specified in the bsrweight() option of svyset. The default is bsn(1).
The bsn() option of svy bootstrap overrides the bsn() option of svyset; see [SVY] svyset.
Options
saving( filename , suboptions ) creates a Stata data file (.dta file) consisting of (for each statistic
in exp list) a variable containing the replicates.
double specifies that the results for each replication be saved as doubles, meaning 8-byte reals.
By default, they are saved as floats, meaning 4-byte reals. This option may be used without
the saving() option to compute the variance estimates by using double precision.
every(#) specifies that results be written to disk every #th replication. every() should be specified
in conjunction with saving() only when command takes a long time for each replication.
This will allow recovery of partial results should some other software crash your computer.
See [P] postfile.
replace indicates that filename be overwritten if it exists. This option does not appear in the
dialog box.
mse specifies that svy bootstrap compute the variance by using deviations of the replicates from the
observed value of the statistics based on the entire dataset. By default, svy bootstrap computes
the variance by using deviations of the replicates from their mean.
svy bootstrap — Bootstrap for survey data 77
Reporting
verbose requests that the full table legend be displayed.
nodots suppresses display of the replication dots. By default, one dot character is printed for each
successful replication. A red ‘x’ is printed if command returns with an error, and ‘e’ is printed if
one of the values in exp list is missing.
noisily requests that any output from command be displayed. This option implies the nodots
option.
trace causes a trace of the execution of command to be displayed. This option implies the noisily
option.
title(text) specifies a title to be displayed above the table of bootstrap results; the default title is
“Bootstrap results”.
eform option; see [R] eform option. This option is ignored if exp list is not b.
Advanced
nodrop prevents observations outside e(sample) and the if and in qualifiers from being dropped
before the data are resampled.
reject(exp) identifies an expression that indicates when results should be rejected. When exp is
true, the resulting values are reset to missing values.
dof(#) specifies the design degrees of freedom, overriding the default calculation, df = Npsu −Nstrata .
Example 1
Suppose that we need to estimate the average birthweight for the population represented by the
National Maternal and Infant Health Survey (NMIHS) (Gonzalez, Krauss, and Scott 1992).
In [SVY] svy estimation, the dataset nmihs.dta contained the following design information:
• Primary sampling units are mothers; that is, PSUs are individual observations — there is no
separate PSU variable.
• The finalwgt variable contains the sampling weights.
• The stratan variable identifies strata.
• There is no variable for the finite population correction.
nmihs bs.dta is equivalent to nmihs.dta except that the stratum identifier variable stratan is
replaced by bootstrap replicate-weight variables. The replicate-weight variables are already svyset,
and the default method for variance estimation is vce(bootstrap).
78 svy bootstrap — Bootstrap for survey data
. use http://www.stata-press.com/data/r14/nmihs_bs
. svyset
pweight: finwgt
VCE: bootstrap
MSE: off
bsrweight: bsrw1 bsrw2 bsrw3 bsrw4 bsrw5 bsrw6 bsrw7 bsrw8 bsrw9 bsrw10
bsrw11 bsrw12 bsrw13 bsrw14 bsrw15 bsrw16 bsrw17 bsrw18 bsrw19
(output omitted )
bsrw989 bsrw990 bsrw991 bsrw992 bsrw993 bsrw994 bsrw995
bsrw996 bsrw997 bsrw998 bsrw999 bsrw1000
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
Now we can use svy: mean to estimate the average birthweight for our population, and the standard
errors will be estimated using the survey bootstrap.
. svy, nodots: mean birthwgt
Survey: Mean estimation Number of obs = 9,946
Population size = 3,895,562
Replications = 1,000
From these results, we are 95% confident that the mean birthweight for our population is between
3,343 and 3,368 grams.
Example 2
nmihs mbs.dta is equivalent to nmihs.dta except that the strata identifier variable stratan is
replaced by mean bootstrap replicate-weight variables. The replicate-weight variables and variance
adjustment are already svyset, and the default method for variance estimation is vce(bootstrap).
svy bootstrap — Bootstrap for survey data 79
. use http://www.stata-press.com/data/r14/nmihs_mbs
. svyset
pweight: finwgt
VCE: bootstrap
MSE: off
bsrweight: mbsrw1 mbsrw2 mbsrw3 mbsrw4 mbsrw5 mbsrw6 mbsrw7 mbsrw8 mbsrw9
mbsrw10 mbsrw11 mbsrw12 mbsrw13 mbsrw14 mbsrw15 mbsrw16
(output omitted )
mbsrw192 mbsrw193 mbsrw194 mbsrw195 mbsrw196 mbsrw197 mbsrw198
mbsrw199 mbsrw200
bsn: 5
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
Notice that the 200 mean bootstrap replicate-weight variables were generated from 5 bootstrap samples;
in fact, the mean bootstrap weight variables in nmihs mbs.dta were generated from the bootstrap
weight variables in nmihs bs.dta.
Here we use svy: mean to estimate the average birthweight for our population.
. svy, nodots: mean birthwgt
Survey: Mean estimation Number of obs = 9,946
Population size = 3,895,562
Replications = 200
The standard error and confidence limits differ from the previous example. This merely illustrates
that the mean bootstrap is not numerically equivalent to the standard bootstrap, even when the
replicate-weight variables are generated from the same resampled datasets.
80 svy bootstrap — Bootstrap for survey data
Stored results
In addition to the results documented in [SVY] svy, svy bootstrap stores the following in e():
Scalars
e(N reps) number of replications
e(N misreps) number of replications with missing values
e(k exp) number of standard expressions
e(k eexp) number of b/ se expressions
e(k extra) number of extra estimates added to b
e(bsn) bootstrap mean-weight adjustment
Macros
e(cmdname) command name from command
e(cmd) same as e(cmdname) or bootstrap
e(vce) bootstrap
e(exp#) #th expression
e(bsrweight) bsrweight() variable list
Matrices
e(b bs) bootstrap means
e(V) bootstrap variance estimates
When exp list is b, svy bootstrap will also carry forward most of the results already in e() from
command.
References
Gonzalez, J. F., Jr., N. Krauss, and C. Scott. 1992. Estimation in the 1988 National Maternal and Infant Health
Survey. Proceedings of the Section on Statistics Education, American Statistical Association 343–348.
Kolenikov, S. 2010. Resampling variance estimation for complex survey data. Stata Journal 10: 165–199.
McCarthy, P. J., and C. B. Snowden. 1985. The bootstrap and finite population sampling. In Vital and Health Statistics,
1–23. Washington, DC: U.S. Government Printing Office.
Rao, J. N. K., and C. F. J. Wu. 1988. Resampling inference with complex survey data. Journal of the American
Statistical Association 83: 231–241.
Rao, J. N. K., C. F. J. Wu, and K. Yue. 1992. Some recent work on resampling methods for complex surveys. Survey
Methodology 18: 209–217.
Yeo, D., H. Mantel, and T.-P. Liu. 1999. Bootstrap variance estimation for the National Population Health Survey.
In Proceedings of the Survey Research Methods Section, 778–785. American Statistical Association.
Yung, W. 1997. Variance estimation for public use files under confidentiality constraints. In Proceedings of the Survey
Research Methods Section, 434–439. American Statistical Association.
svy bootstrap — Bootstrap for survey data 81
Also see
[SVY] svy postestimation — Postestimation tools for svy
[R] bootstrap — Bootstrap sampling and estimation
[SVY] svy brr — Balanced repeated replication for survey data
[SVY] svy jackknife — Jackknife estimation for survey data
[SVY] svy sdr — Successive difference replication for survey data
[U] 20 Estimation and postestimation commands
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
Title
svy brr — Balanced repeated replication for survey data
Description
svy brr performs balanced repeated replication (BRR) estimation of specified statistics (or ex-
pressions) for a Stata command or a user-written command. The command is executed once for
each replicate using sampling weights that are adjusted according to the BRR methodology. Any
Stata estimation command listed in [SVY] svy estimation may be used with svy brr. User-written
commands that meet the requirements in [P] program properties may also be used.
Quick start
Estimate population mean of v1 using BRR standard-error estimates with sampling weight wvar1 and
replicate weights in variables with prefix rwvar
svyset [pweight = wvar1], brrweight(rwvar*)
svy brr _b: mean v1
BRR estimate of the standard error of the difference between the means of v2 and v3
svy brr (_b[v2]-_b[v3]): mean v2 v3
As above, but name the result diff and save results from each replication to mydata.dta
svy brr diff=(_b[v2]-_b[v3]), saving(mydata): mean v2 v3
Same as above
brr diff=(_b[v2]-_b[v3]), saving(mydata): mean v2 v3
Note: Any estimation command meeting the requirements specified in the Description may be
substituted for mean in the examples above.
Menu
Statistics > Survey data analysis > Resampling > Balanced repeated replications estimation
82
svy brr — Balanced repeated replication for survey data 83
Syntax
svy brr exp list , svy options brr options eform option : command
svy options Description
if/in
subpop( varname if ) identify a subpopulation
Reporting
level(#) set confidence level; default is level(95)
noheader suppress table header
nolegend suppress table legend
noadjust do not adjust model Wald statistic
nocnsreport do not display constraints
display options control columns and column formats, row spacing, line width,
display of omitted variables and base and empty cells, and
factor-variable labeling
coeflegend display legend instead of statistics
coeflegend is not shown in the dialog boxes for estimation commands.
exp list specifies the statistics to be collected from the execution of command. exp list is required
unless command has the svyb program property, in which case exp list defaults to b; see [P] program
properties. The expressions in exp list are assumed to conform to the following:
exp list contains (name: elist)
elist
eexp
elist contains newvarname = (exp)
(exp)
eexp is specname
[eqno]specname
specname is b
b[]
se
se[]
eqno is ##
name
exp is a standard Stata expression; see [U] 13 Functions and expressions.
Distinguish between [ ], which are to be typed, and , which indicate optional arguments.
Options
svy options; see [SVY] svy.
Main
hadamard(matrix) specifies the Hadamard matrix to be used to determine which PSUs are chosen
for each replicate.
fay(#) specifies Fay’s adjustment (Judkins 1990), where 0 ≤ # ≤ 2, but excluding 1. This option
overrides the fay(#) option of svyset; see [SVY] svyset.
Options
saving( filename , suboptions ) creates a Stata data file (.dta file) consisting of (for each statistic
in exp list) a variable containing the replicates.
double specifies that the results for each replication be saved as doubles, meaning 8-byte reals.
By default, they are saved as floats, meaning 4-byte reals. This option may be used without
the saving() option to compute the variance estimates by using double precision.
every(#) specifies that results be written to disk every #th replication. every() should be specified
in conjunction with saving() only when command takes a long time for each replication.
This will allow recovery of partial results should some other software crash your computer.
See [P] postfile.
replace indicates that filename be overwritten if it exists. This option does not appear in the
dialog box.
mse specifies that svy brr compute the variance by using deviations of the replicates from the
observed value of the statistics based on the entire dataset. By default, svy brr computes the
variance by using deviations of the replicates from their mean.
svy brr — Balanced repeated replication for survey data 85
Reporting
verbose requests that the full table legend be displayed.
nodots suppresses display of the replication dots. By default, one dot character is printed for each
successful replication. A red ‘x’ is printed if command returns with an error, and ‘e’ is printed if
one of the values in exp list is missing.
noisily requests that any output from command be displayed. This option implies the nodots
option.
trace causes a trace of the execution of command to be displayed. This option implies the noisily
option.
title(text) specifies a title to be displayed above the table of BRR results; the default title is “BRR
results”.
eform option; see [R] eform option. This option is ignored if exp list is not b.
Advanced
nodrop prevents observations outside e(sample) and the if and in qualifiers from being dropped
before the data are resampled.
reject(exp) identifies an expression that indicates when results should be rejected. When exp is
true, the resulting values are reset to missing values.
dof(#) specifies the design degrees of freedom, overriding the default calculation, df = Npsu −Nstrata .
. use http://www.stata-press.com/data/r14/nhanes2
. svydescribe
Survey: Describing stage 1 sampling units
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: strata
SU 1: psu
FPC 1: <zero>
#Obs per Unit
Here is a privacy-conscious dataset equivalent to the one above; all the variables and values remain,
except strata and psu are replaced with BRR replicate-weight variables. The BRR replicate-weight
variables are already svyset, and the default method for variance estimation is vce(brr).
. use http://www.stata-press.com/data/r14/nhanes2brr
. svyset
pweight: finalwgt
VCE: brr
MSE: off
brrweight: brr_1 brr_2 brr_3 brr_4 brr_5 brr_6 brr_7 brr_8 brr_9 brr_10
brr_11 brr_12 brr_13 brr_14 brr_15 brr_16 brr_17 brr_18 brr_19
brr_20 brr_21 brr_22 brr_23 brr_24 brr_25 brr_26 brr_27 brr_28
brr_29 brr_30 brr_31 brr_32
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
Suppose that we were interested in the population ratio of weight to height. Here we use total
to estimate the population totals of weight and height and the svy brr prefix to estimate their
ratio and variance; we use total instead of ratio (which is otherwise preferable here) to illustrate
how to specify an exp list.
svy brr — Balanced repeated replication for survey data 87
BRR
Coef. Std. Err. t P>|t| [95% Conf. Interval]
The mse option causes svy brr to use the MSE form of the BRR variance estimator. This variance
estimator will tend to be larger than the previous because of the addition of the familiar squared
bias term in the MSE; see [SVY] variance estimation for more details. The header for the column of
standard errors in the table of results is BRR * for the BRR variance estimator using the MSE formula.
. svy brr WtoH = (_b[weight]/_b[height]), mse: total weight height
(running total on estimation sample)
BRR replications (32)
1 2 3 4 5
................................
BRR results Number of obs = 10,351
Population size = 117,157,513
Replications = 32
Design df = 31
command: total weight height
WtoH: _b[weight]/_b[height]
BRR *
Coef. Std. Err. t P>|t| [95% Conf. Interval]
The bias term here is too small to see any difference in the standard errors.
. use http://www.stata-press.com/data/r14/nhanes2
. svy brr, hadamard(h32): ratio (WtoH: weight/height)
(running ratio on estimation sample)
BRR replications (32)
1 2 3 4 5
................................
Survey: Ratio estimation
Number of strata = 31 Number of obs = 10,351
Number of PSUs = 62 Population size = 117,157,513
Replications = 32
Design df = 31
WtoH: weight/height
BRR
Ratio Std. Err. [95% Conf. Interval]
Technical note
A Hadamard matrix is a square matrix with r rows and columns that has the property
Hr0 Hr = rIr
where Ir is the identity matrix of order r. Generating a Hadamard matrix with order r = 2p is
easily accomplished. Start with a Hadamard matrix of order 2 (H2 ), and build your Hr by repeatedly
applying Kronecker products with H2 . Here is the Stata code to generate the Hadamard matrix for
the previous example.
matrix h2 = (-1, 1 \ 1, 1)
matrix h32 = h2
forvalues i = 1/4 {
matrix h32 = h2 # h32
}
svy brr consumes Hadamard matrices from left to right, so it is best to make sure that r is greater
than the number of strata and that the last column is the one consisting of all 1s. This will ensure
full orthogonal balance according to Wolter (2007).
svy brr — Balanced repeated replication for survey data 89
Stored results
In addition to the results documented in [SVY] svy, svy brr stores the following in e():
Scalars
e(N reps) number of replications
e(N misreps) number of replications with missing values
e(k exp) number of standard expressions
e(k eexp) number of b/ se expressions
e(k extra) number of extra estimates added to b
e(fay) Fay’s adjustment
Macros
e(cmdname) command name from command
e(cmd) same as e(cmdname) or brr
e(vce) brr
e(brrweight) brrweight() variable list
Matrices
e(b brr) BRR means
e(V) BRR variance estimates
When exp list is b, svy brr will also carry forward most of the results already in e() from
command.
References
Judkins, D. R. 1990. Fay’s method for variance estimation. Journal of Official Statistics 6: 223–239.
McCarthy, P. J. 1966. Replication: An approach to the analysis of data from complex surveys. In Vital and Health
Statistics, series 2. Hyattsville, MD: National Center for Health Statistics.
. 1969a. Pseudoreplication: Further evaluation and application of the balanced half-sample technique. In Vital
and Health Statistics, series 2. Hyattsville, MD: National Center for Health Statistics.
. 1969b. Pseudo-replication: Half-samples. Revue de l’Institut International de Statistique 37: 239–264.
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Wolter, K. M. 2007. Introduction to Variance Estimation. 2nd ed. New York: Springer.
Also see
[SVY] svy postestimation — Postestimation tools for svy
[SVY] svy bootstrap — Bootstrap for survey data
[SVY] svy jackknife — Jackknife estimation for survey data
[SVY] svy sdr — Successive difference replication for survey data
[U] 20 Estimation and postestimation commands
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
Title
svy estimation — Estimation commands for survey data
Description
Survey data analysis in Stata is essentially the same as standard data analysis. The standard syntax
applies; you just need to also remember the following:
• Use svyset to identify the survey design characteristics.
• Prefix the estimation commands with “svy:”.
For example,
. use http://www.stata-press.com/data/r14/nhanes2f
. svyset psuid [pweight=finalwgt], strata(stratid)
. svy: regress zinc age c.age#c.age weight female black orace rural
Descriptive statistics
mean [R] mean — Estimate means
proportion [R] proportion — Estimate proportions
ratio [R] ratio — Estimate ratios
total [R] total — Estimate totals
90
svy estimation — Estimation commands for survey data 91
Menu
Statistics > Survey data analysis > ...
Dialog boxes for all statistical estimators that support svy can be found on the above menu path.
In addition, you can access survey data estimation from standard dialog boxes on the SE/Robust or
SE/Cluster tab.
Most standard commands (and all standard commands supported by svy) allow pweights and
the vce(cluster clustvar) option, where clustvar corresponds to the PSU variable that you svyset.
If your survey data exhibit only sampling weights or first-stage clusters (or both), you can get by
with using the standard command with pweights, vce(cluster clustvar), or both. Your parameter
estimates will always be identical to those you would have obtained from the svy command, and the
standard command uses the same robust (linearization) variance estimator as the svy command with
a similarly svyset design.
Most standard commands are also fit using maximum likelihood. When used with independently
distributed, nonweighted data, the likelihood to be maximized reflects the joint probability distribution
of the data given the chosen model. With complex survey data, however, this interpretation of the
likelihood is no longer valid, because survey data are weighted, not independently distributed, or
both. Yet for survey data, (valid) parameter estimates for a given model can be obtained using the
associated likelihood function with appropriate weighting. Because the probabilistic interpretation no
longer holds, the likelihood here is instead called a pseudolikelihood, but likelihood-ratio tests are no
longer valid. See Skinner (1989, sec. 3.4.4) for a discussion of maximum pseudolikelihood estimators.
• svy: regress differs slightly from regress and svy: ivregress differs slightly from
ivregress in that they use different multipliers for the variance estimator. regress and
ivregress (when the small option is specified) use a multiplier of {(N − 1)/(N −k)}{n/(n−
1)}, where N is the number of observations, n is the number of clusters (PSUs), and k is
the number of regressors including the constant. svy: regress and svy: ivregress use
n/(n − 1) instead. Thus they produce slightly different standard errors. The (N − 1)/(N − k)
is ad hoc and has no rigorous theoretical justification; hence, the purist svy commands do not
use it. The svy commands tacitly assume that N k . If (N − 1)/(N − k) is not close to 1,
you may be well advised to use regress or ivregress so that some punishment is inflicted on
your variance estimates. Maximum likelihood estimators in Stata (for example, logit) do no
such adjustment but rely on the sensibilities of the analyst to ensure that N is reasonably larger
94 svy estimation — Estimation commands for survey data
than k . Thus the maximum pseudolikelihood estimators (for example, svy: logit) produce
the same standard errors as the corresponding maximum likelihood commands (for example,
logit), but p-values are slightly different because of the point made in the second bullet.
• svy commands can produce proper estimates for subpopulations by using the subpop() option.
Using an if restriction with svy or standard commands can yield incorrect standard-error esti-
mates for subpopulations. Often an if restriction will yield the same standard error as subpop();
most other times, the two standard errors will be slightly different; but sometimes — usually for
thinly sampled subpopulations — the standard errors can be appreciably different. Hence, the
svy command with the subpop() option should be used to obtain estimates for thinly sampled
subpopulations. See [SVY] subpopulation estimation for more information.
• svy commands handle zero sampling weights properly. Standard commands ignore any obser-
vation with a weight of zero. Usually, this will yield the same standard errors, but sometimes
they will differ. Sampling weights of zero can arise from various postsampling adjustment
procedures. If the sum of weights for one or more PSUs is zero, svy and standard commands
will produce different standard errors, but usually this difference is very small.
• You can svyset iweights and let these weights be negative. Negative sampling weights can
arise from various postsampling adjustment procedures. If you want to use negative sampling
weights, then you must svyset iweights instead of pweights; no standard command will
allow negative sampling weights.
• The svy commands compute finite population corrections (FPCs).
• After a svy command, estat effects will compute the design effects DEFF and DEFT and
the misspecification effects MEFF and MEFT.
• svy commands can perform variance estimation that accounts for multiple stages of clustered
sampling.
• svy commands can perform variance estimation that accounts for poststratification adjustments
to the sampling weights.
• Some standard options are not allowed with the svy prefix. For example, vce() and weights
cannot be specified when using the svy prefix because svy is already using the variance
estimation and sampling weights identified by svyset. Some options are not allowed with
survey data because they would be statistically invalid, such as noskip for producing optional
likelihood-ratio tests. Other options are not allowed because they change how estimation results
are reported (for example, nodisplay, first, plus) or are not compatible with svy’s variance
estimation methods (for example, irls, mse1, hc2, hc3).
• Estimation results are presented in the standard way, except that svy has its own table header:
In addition to the sample size, model test, and R2 (if present in the output from the standard
command), svy will also report the following information in the header:
a. number of strata and PSUs
b. number of poststrata, if specified to svyset
c. population size estimate
d. subpopulation sizes, if the subpop() option was specified
e. design degrees of freedom
svy estimation — Estimation commands for survey data 95
Descriptive statistics
Use svy: mean, svy: ratio, svy: proportion, and svy: total to estimate finite population and
subpopulation means, ratios, proportions, and totals, respectively. You can also estimate standardized
means, ratios, and proportions for survey data; see [SVY] direct standardization. Estimates for multiple
subpopulations can be obtained using the over() option; see [SVY] subpopulation estimation.
Example 1
Suppose that we need to estimate the average birthweight for the population represented by the
National Maternal and Infant Health Survey (NMIHS) (Gonzalez, Krauss, and Scott 1992).
First, we gather the survey design information.
• Primary sampling units are mothers; that is, PSUs are individual observations — there is no
separate PSU variable.
• The finalwgt variable contains the sampling weights.
• The stratan variable identifies strata.
• There is no variable for the finite population correction.
Then we use svyset to identify the variables for sampling weights and stratification.
. use http://www.stata-press.com/data/r14/nmihs
. svyset [pweight=finwgt], strata(stratan)
pweight: finwgt
VCE: linearized
Single unit: missing
Strata 1: stratan
SU 1: <observations>
FPC 1: <zero>
Now we can use svy: mean to estimate the average birthweight for our population.
. svy: mean birthwgt
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 6 Number of obs = 9,946
Number of PSUs = 9,946 Population size = 3,895,562
Design df = 9,940
Linearized
Mean Std. Err. [95% Conf. Interval]
From these results, we are 95% confident that the mean birthweight for our population is between
3,343 and 3,368 grams.
96 svy estimation — Estimation commands for survey data
Regression models
As exhibited in the table at the beginning of this manual entry, many of Stata’s regression model
commands support the svy prefix. If you know how to use one of these commands with standard
data, then you can also use the corresponding svy command with your survey data.
Example 2
Let’s model the incidence of high blood pressure with a dataset from the Second National Health and
Nutrition Examination Survey (NHANES II) (McDowell et al. 1981). The survey design characteristics
are already svyset, so we will just replay them.
. use http://www.stata-press.com/data/r14/nhanes2d
. svyset
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: strata
SU 1: psu
FPC 1: <zero>
Now we can use svy: logistic to model the incidence of high blood pressure as a function of
height, weight, age, and sex (using the female indicator variable).
. svy: logistic highbp height weight age female
(running logistic on estimation sample)
Survey: Logistic regression
Number of strata = 31 Number of obs = 10,351
Number of PSUs = 62 Population size = 117,157,513
Design df = 31
F( 4, 28) = 368.33
Prob > F = 0.0000
Linearized
highbp Odds Ratio Std. Err. t P>|t| [95% Conf. Interval]
The odds ratio for the female predictor is 0.63 (rounded to two decimal places) and is significantly
less than 1. This finding implies that females have a lower incidence of high blood pressure than do
males.
Here we use the subpop() option to model the incidence of high blood pressure in the subpopulation
identified by the female variable.
svy estimation — Estimation commands for survey data 97
Linearized
highbp Odds Ratio Std. Err. t P>|t| [95% Conf. Interval]
Because the odds ratio for the age predictor is significantly greater than 1, we can conclude that
older females are more likely to have high blood pressure than are younger females.
Health surveys
There are many sources of bias when modeling the association between a disease and its risk
factors (Korn, Graubard, and Midthune 1997; Korn and Graubard 1999, sec. 3.7). In cross-sectional
health surveys, inference is typically restricted to the target population as it stood when the data were
collected. This type of survey cannot capture the fact that participants may change their habits over
time. Some health surveys collect data retrospectively, relying on the participants to recall the status
of risk factors as they stood in the past. This type of survey is vulnerable to recall bias.
Longitudinal surveys collect data over time, monitoring the survey participants over several years.
Although the above biases are minimized, analysts are still faced with some tough choices/situations
when modeling time-to-event data. For example:
• Time scale. When studying cancer, should we measure the time scale by using the participant’s
age or the initial date from which data were collected?
• Time-varying covariates. Were all relevant risk factors sampled over time, or do we have only
the baseline measurement?
• Competing risks. When studying mortality, do we have the data specific to cause of death?
Binder (1983) provides the foundation for fitting most of the common parametric models by using
survey data. Similarly, Lin and Wei (1989) provide the foundational theory for robust inference by
using the proportional hazards model. Binder (1992) describes how to estimate standard errors for
the proportional hazards model from survey data, and Lin (2000) provides a rigorous justification for
Binder’s method. Korn and Graubard (1999) discuss many aspects of model fitting by using data from
health surveys. O’Donnell et al. (2008, chap. 10) use Stata survey commands to perform multivariate
analysis using health survey data.
98 svy estimation — Estimation commands for survey data
The lung cancer information was taken from the 1992 NHEFS interview data. We use the participants’
ages for the time scale. Participants who never had lung cancer and were alive for the 1992 interview
were considered censored. Participants who never had lung cancer and died before the 1992 interview
were also considered censored at their age of death.
. stset age_lung_cancer [pw=swgt2], fail(lung_cancer)
failure event: lung_cancer != 0 & lung_cancer < .
obs. time interval: (0, age_lung_cancer]
exit on or before: failure
weight: [pweight=swgt2]
Although stset warns us that it is a “probable error” to have 5,126 observations with missing event
times, we can verify from the 1992 NHEFS documentation that there were indeed 9,281 participants
with complete information.
For our proportional hazards model, we pulled the risk factor information from the NHANES I and
1992 NHEFS datasets. Smoking status was taken from the 1992 NHEFS interview data, but we filled
in all but 132 missing values by using the general medical history supplement data in NHANES I.
Smoking status is represented by separate indicator variables for former smokers and current smokers;
the base comparison group is nonsmokers. Sex was determined using the 1992 NHEFS vitality data
and is represented by an indicator variable for males. Place-of-residence information was taken from
the medical history questionnaire in NHANES I and is represented by separate indicator variables for
rural and heavily populated (more than 1 million people) urban residences; the base comparison group
is urban residences with populations of fewer than 1 million people.
svy estimation — Estimation commands for survey data 99
Linearized
_t Haz. Ratio Std. Err. t P>|t| [95% Conf. Interval]
From the above results, we can see that both former and current smokers have a significantly
higher risk for developing lung cancer than do nonsmokers.
Technical note
In the previous example, we specified a sampling weight variable in the calls to both svyset
and stset. When the svy prefix is used with stcox and streg, it identifies the sampling weight
variable by using the data characteristics from both svyset and stset. svy will report an error if
the svyset pweight variable is different from the stset pweight variable. The svy prefix will use
the specified pweight variable, even if it is svyset but not stset. If a pweight variable is stset
but not svyset, svy will note that it will be using the stset pweight variable and then svyset it.
The standard st commands will not use the svyset pweight variable if it is not also stset.
10
−ln[−ln(Survival Probability)]
4 6 2 8
As we can see from the graph produced above, the lines for the black and white race categories
intersect. This indicates a violation of the proportional-hazards assumption, so we should consider
using separate baseline hazard functions for each race category in our model fit. We do this next, by
specifying strata(revised race) in our call to svy: stcox.
. svy: stcox former_smoker smoker male urban1 rural, strata(revised_race)
(running stcox on estimation sample)
Survey: Cox regression
Number of strata = 35 Number of obs = 9,149
Number of PSUs = 105 Population size = 151,327,827
Design df = 70
F( 5, 66) = 13.95
Prob > F = 0.0000
Linearized
_t Haz. Ratio Std. Err. t P>|t| [95% Conf. Interval]
Stratified by revised_race
References
Binder, D. A. 1983. On the variances of asymptotically normal estimators from complex surveys. International
Statistical Review 51: 279–292.
. 1992. Fitting Cox’s proportional hazards models for survey data. Biometrika 79: 139–147.
svy estimation — Estimation commands for survey data 101
Cox, C. S., M. E. Mussolino, S. T. Rothwell, M. A. Lane, C. D. Golden, J. H. Madans, and J. J. Feldman. 1997.
Plan and operation of the NHANES I Epidemiologic Followup Study, 1992. In Vital and Health Statistics, series 1,
no. 35. Hyattsville, MD: National Center for Health Statistics.
Engel, A., R. S. Murphy, K. Maurer, and E. Collins. 1978. Plan and operation of the HANES I augmentation survey
of adults 25–74 years: United States 1974–75. In Vital and Health Statistics, series 1, no. 14. Hyattsville, MD:
National Center for Health Statistics.
Gonzalez, J. F., Jr., N. Krauss, and C. Scott. 1992. Estimation in the 1988 National Maternal and Infant Health
Survey. Proceedings of the Section on Statistics Education, American Statistical Association 343–348.
Korn, E. L., and B. I. Graubard. 1999. Analysis of Health Surveys. New York: Wiley.
Korn, E. L., B. I. Graubard, and D. Midthune. 1997. Time-to-event analysis of longitudinal follow-up of a survey:
Choice of time-scale. American Journal of Epidemiology 145: 72–80.
Lin, D. Y. 2000. On fitting Cox’s proportional hazards models to survey data. Biometrika 87: 37–47.
Lin, D. Y., and L. J. Wei. 1989. The robust inference for the Cox proportional hazards model. Journal of the American
Statistical Association 84: 1074–1078.
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Miller, H. W. 1973. Plan and operation of the Health and Nutrition Examination Survey: United States 1971–1973.
Hyattsville, MD: National Center for Health Statistics.
O’Donnell, O., E. van Doorslaer, A. Wagstaff, and M. Lindelow. 2008. Analyzing Health Equity Using Household
Survey Data: A Guide to Techniques and Their Implementation. Washington, DC: The World Bank.
Skinner, C. J. 1989. Introduction to part A. In Analysis of Complex Surveys, ed. C. J. Skinner, D. Holt, and
T. M. F. Smith, 23–58. New York: Wiley.
Also see
[SVY] svy postestimation — Postestimation tools for svy
[SVY] estat — Postestimation statistics for survey data
[SVY] direct standardization — Direct standardization of means, proportions, and ratios
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
[U] 20 Estimation and postestimation commands
[SVY] svyset — Declare survey design for dataset
[SVY] svy — The survey prefix command
Title
svy jackknife — Jackknife estimation for survey data
Description
svy jackknife performs jackknife estimation of specified statistics (or expressions) for a Stata
command or a user-written command. The command is executed once for each replicate using sampling
weights that are adjusted according to the jackknife methodology. Any Stata estimation command
listed in [SVY] svy estimation may be used with svy jackknife. User-written commands that meet
the requirements in [P] program properties may also be used.
Quick start
Estimate population mean of v1 using jackknife standard-error estimates with sampling weight wvar1
and sampling units identified by su1
svyset su1 [pweight = wvar1]
svy jackknife _b: mean v1
Same as above, but with jackknife replication weights in variables with prefix rwvar
svyset [pweight = wvar1], vce(jackknife) jkrweight(rwvar*)
svy: mean v1
Jackknife standard error of the difference between the means of v2 and v3 using either svyset
command above
svy jackknife (_b[v2]-_b[v3]): mean v2 v3
As above, but name the result diff and save results from each replication to mydata.dta
svy jackknife diff=(_b[v2]-_b[v3]), saving(mydata): mean v2 v3
Note: Any estimation command meeting the requirements specified in the Description may be
substituted for mean in the examples above.
Menu
Statistics > Survey data analysis > Resampling > Jackknife estimation
102
svy jackknife — Jackknife estimation for survey data 103
Syntax
svy jackknife exp list , svy options jackknife options eform option : command
exp list specifies the statistics to be collected from the execution of command. exp list is required
unless command has the svyj program property, in which case exp list defaults to b; see [P] program
properties. The expressions in exp list are assumed to conform to the following:
exp list contains (name: elist)
elist
eexp
elist contains newvarname = (exp)
(exp)
eexp is specname
[eqno]specname
specname is b
b[]
se
se[]
eqno is ##
name
exp is a standard Stata expression; see [U] 13 Functions and expressions.
Distinguish between [ ], which are to be typed, and , which indicate optional arguments.
Options
svy options; see [SVY] svy.
Main
eclass, rclass, and n(exp) specify where command stores the number of observations on which
it based the calculated results. We strongly advise you to specify one of these options.
eclass specifies that command store the number of observations in e(N).
rclass specifies that command store the number of observations in r(N).
n(exp) allows you to specify an expression that evaluates to the number of observations used.
Specifying n(r(N)) is equivalent to specifying the rclass option. Specifying n(e(N)) is equiv-
alent to specifying the eclass option. If command stores the number of observations in r(N1),
specify n(r(N1)).
If you specify none of these options, svy jackknife will assume eclass or rclass depending
upon which of e(N) and r(N) is not missing (in that order). If both e(N) and r(N) are missing,
svy jackknife assumes that all observations in the dataset contribute to the calculated result. If
that assumption is incorrect, then the reported standard errors will be incorrect. For instance, say
that you specify
. svy jackknife coef=_b[x2]: myreg y x1 x2 x3
where myreg uses e(n) instead of e(N) to identify the number of observations used in calculations.
Further assume that observation 42 in the dataset has x3 equal to missing. The 42nd observation
plays no role in obtaining the estimates, but svy jackknife has no way of knowing that and will
use the wrong N . If, on the other hand, you specify
. svy jackknife coef=_b[x2], n(e(n)): myreg y x1 x2 x3
svy jackknife — Jackknife estimation for survey data 105
Then svy jackknife will notice that observation 42 plays no role. The n(e(n)) option is
specified because myreg is an estimation command, but it stores the number of observations
used in e(n) (instead of the standard e(N)). When svy jackknife runs the regression omitting
the 42nd observation, svy jackknife will observe that e(n) has the same value as when svy
jackknife previously ran the regression by using all the observations. Thus svy jackknife will
know that myreg did not use the observation.
Options
saving( filename , suboptions ) creates a Stata data file (.dta file) consisting of (for each statistic
in exp list) a variable containing the replicates.
double specifies that the results for each replication be saved as doubles, meaning 8-byte reals.
By default, they are saved as floats, meaning 4-byte reals. This option may be used without
the saving() option to compute the variance estimates by using double precision.
every(#) specifies that results be written to disk every #th replication. every() should be specified
in conjunction with saving() only when command takes a long time for each replication.
This will allow recovery of partial results should some other software crash your computer.
See [P] postfile.
replace indicates that filename be overwritten if it exists. This option does not appear in the
dialog box.
keep specifies that new variables be added to the dataset containing the pseudovalues of the requested
statistics. For instance, if you typed
. svy jackknife coef=_b[x2], eclass keep: regress y x1 x2 x3
Then the new variable coef would be added to the dataset containing the pseudovalues for b[x2].
Let b be defined as the value of b[x2] when all observations are used to fit the model, and let
b(j) be the value when the j th observation is omitted. The pseudovalues are defined as
pseudovaluej = N × {b − b(j)} + b(j)
eform option; see [R] eform option. This option is ignored if exp list is not b.
Advanced
nodrop prevents observations outside e(sample) and the if and in qualifiers from being dropped
before the data are resampled.
reject(exp) identifies an expression that indicates when results should be rejected. When exp is
true, the resulting values are reset to missing values.
dof(#) specifies the design degrees of freedom, overriding the default calculation, df = Npsu −Nstrata .
(N − 1) y (j) + yj
y=
N
Solving for yj , we obtain
yj = N y − (N − 1) y (j)
These are the pseudovalues that svy: jackknife calculates. To move this discussion beyond the
sample mean, let θb be the value of our statistic (not necessarily the sample mean) using the entire
dataset, and let θb(j) be the computed value of our statistic with the j th observation omitted. The
pseudovalue for the j th observation is
θbj∗ = N θb − (N − 1) θb(j)
The mean of the pseudovalues is the alternative, first-order unbiased estimator mentioned above,
and the standard error of the mean of the pseudovalues is an estimator for the standard error of θb
(Tukey 1958, Shao and Tu 1995).
When the jackknife is applied to survey data, primary sampling units (PSUs) are omitted instead
of observations, N is the number of PSUs instead of the sample size, and the sampling weights are
adjusted owing to omitting PSUs; see [SVY] variance estimation for more details.
Because of privacy concerns, many public survey datasets contain jackknife replication-weight
variables instead of variables containing information on the PSUs and strata. These replication-weight
variables are the adjusted sampling weights, and there is one replication-weight variable for each
omitted PSU.
svy jackknife — Jackknife estimation for survey data 107
Jackknife
Coef. Std. Err. t P>|t| [95% Conf. Interval]
. use http://www.stata-press.com/data/r14/nhanes2jknife
. svyset
pweight: finalwgt
VCE: jackknife
MSE: off
jkrweight: jkw_1 jkw_2 jkw_3 jkw_4 jkw_5 jkw_6 jkw_7 jkw_8 jkw_9 jkw_10
jkw_11 jkw_12 jkw_13 jkw_14 jkw_15 jkw_16 jkw_17 jkw_18 jkw_19
jkw_20 jkw_21 jkw_22 jkw_23 jkw_24 jkw_25 jkw_26 jkw_27 jkw_28
jkw_29 jkw_30 jkw_31 jkw_32 jkw_33 jkw_34 jkw_35 jkw_36 jkw_37
jkw_38 jkw_39 jkw_40 jkw_41 jkw_42 jkw_43 jkw_44 jkw_45 jkw_46
jkw_47 jkw_48 jkw_49 jkw_50 jkw_51 jkw_52 jkw_53 jkw_54 jkw_55
jkw_56 jkw_57 jkw_58 jkw_59 jkw_60 jkw_61 jkw_62
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
Here we perform the same analysis as in the previous example, using jackknife replication weights.
. svy jackknife slope = _b[height], nodots: regress weight height
Linear regression
Number of strata = 31 Number of obs = 10,351
Population size = 117,157,513
Replications = 62
Design df = 31
command: regress weight height
slope: _b[height]
Jackknife
Coef. Std. Err. t P>|t| [95% Conf. Interval]
The mse option causes svy jackknife to use the MSE form of the jackknife variance estimator.
This variance estimator will tend to be larger than the previous because of the addition of the familiar
squared bias term in the MSE; see [SVY] variance estimation for more details. The header for the
column of standard errors in the table of results is Jknife * for the jackknife variance estimator,
which uses the MSE formula.
. svy jackknife slope = _b[height], mse nodots: regress weight height
Linear regression
Number of strata = 31 Number of obs = 10,351
Population size = 117,157,513
Replications = 62
Design df = 31
command: regress weight height
slope: _b[height]
Jknife *
Coef. Std. Err. t P>|t| [95% Conf. Interval]
Stored results
In addition to the results documented in [SVY] svy, svy jackknife stores the following in e():
Scalars
e(N reps) number of replications
e(N misreps) number of replications with missing values
e(k exp) number of standard expressions
e(k eexp) number of b/ se expressions
e(k extra) number of extra estimates added to b
Macros
e(cmdname) command name from command
e(cmd) same as e(cmdname) or jackknife
e(vce) jackknife
e(exp#) #th expression
e(jkrweight) jkrweight() variable list
Matrices
e(b jk) jackknife means
e(V) jackknife variance estimates
When exp list is b, svy jackknife will also carry forward most of the results already in e() from
command.
References
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Shao, J., and D. Tu. 1995. The Jackknife and Bootstrap. New York: Springer.
Tukey, J. W. 1958. Bias and confidence in not-quite large samples. Abstract in Annals of Mathematical Statistics 29:
614.
Also see
[SVY] svy postestimation — Postestimation tools for svy
[R] jackknife — Jackknife estimation
[SVY] svy bootstrap — Bootstrap for survey data
[SVY] svy brr — Balanced repeated replication for survey data
[SVY] svy sdr — Successive difference replication for survey data
[U] 20 Estimation and postestimation commands
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
Title
svy postestimation — Postestimation tools for svy
Postestimation commands
The following postestimation commands are available after svy:
command Description
contrast contrasts and ANOVA-style joint tests of estimates
estat (svy) postestimation statistics for survey data
estimates cataloging estimation results
lincom point estimates, standard errors, testing, and inference for linear
combinations of coefficients
margins marginal means, predictive margins, marginal effects, and average marginal
effects
marginsplot graph the results from margins (profile plots, interaction plots, etc.)
nlcom point estimates, standard errors, testing, and inference for nonlinear
combinations of coefficients
predict predictions, residuals, influence statistics, and other diagnostic measures
predictnl point estimates, standard errors, testing, and inference for generalized
predictions
pwcompare pairwise comparisons of estimates
suest seemingly unrelated estimation
test Wald tests of simple and composite linear hypotheses
testnl Wald tests of nonlinear hypotheses
See [SVY] estat.
predict
The syntax of predict (and even if predict is allowed) after svy depends on the command used
with svy. Specifically, predict is not allowed after svy: mean, svy: proportion, svy: ratio,
svy: tabulate, or svy: total.
margins
The syntax of margins (and even if margins is allowed) after svy depends on the command used
with svy. Specifically, margins is not allowed after svy: mean, svy: proportion, svy: ratio,
svy: tabulate, or svy: total.
110
svy postestimation — Postestimation tools for svy 111
Linearized
Over Mean Std. Err. [95% Conf. Interval]
zinc
White 91.15725 .541625 90.0526 92.2619
Black 88.269 1.208336 85.80458 90.73342
Other 85.54716 2.608974 80.22612 90.8682
Then we run lincom to estimate the difference of zinc levels between the two subpopulations.
. lincom [zinc]White - [zinc]Black
( 1) [zinc]White - [zinc]Black = 0
The t statistic and its p-value give a survey analysis equivalent of a two-sample t test.
lincom and nlcom can be used after any of the estimation commands described in [SVY] svy
estimation. lincom can, for example, display results as odds ratios after svy: logit and can be
used to compute odds ratios for one covariate group relative to another. nlcom can display odds
112 svy postestimation — Postestimation tools for svy
ratios, as well, and allows more general nonlinear combinations of the parameters. See [R] lincom
and [R] nlcom for full details. Also see Eltinge and Sribney (1996) for an earlier implementation of
lincom for survey data.
Finally, lincom and nlcom operate on the estimated parameters only. To obtain estimates and
inference for functions of the parameters and of the data, such as for an exponentiated linear predictor
or a predicted probability of success from a logit model, use predictnl; see [R] predictnl.
Linearized
highbp Odds Ratio Std. Err. t P>|t| [95% Conf. Interval]
Because our model includes a quadratic in the age variable, the peak incidence of high blood
pressure with respect to age will occur at - b[age]/(2* b[c.age#c.age]), which we can estimate,
along with its standard error, using nlcom.
. nlcom peak: -_b[age]/(2*_b[c.age#c.age])
peak: -_b[age]/(2*_b[c.age#c.age])
Or we can use testnl to test that the peak incidence of high blood pressure in the population is
70 years.
. testnl -_b[age]/(2*_b[c.age#c.age]) = 70
(1) -_b[age]/(2*_b[c.age#c.age]) = 70
chi2(1) = 0.17
Prob > chi2 = 0.6823
svy postestimation — Postestimation tools for svy 113
These data do not reject our theory. testnl allows multiple hypotheses to be tested jointly and
applies the degrees-of-freedom adjustment for survey results; see [R] testnl.
Linearized
highbp Odds Ratio Std. Err. t P>|t| [95% Conf. Interval]
female
0 1 (base)
1 .6382331 .0377648 -7.59 0.000 .5656774 .720095
race
White 1 (base)
Black 1.422003 .1556023 3.22 0.003 1.137569 1.777557
Other 1.63456 .2929919 2.74 0.010 1.13405 2.355971
Our point estimates indicate that the odds of females having high blood pressure is about 64% of
the odds for men and that the odds of blacks having high blood pressure is about 1.4 times that of
whites. The odds ratios give us the relative effects of their covariates, but they do not give us any
sense of the absolute size of the effects. The odds ratio comparing blacks with whites is clearly large
and statistically significant, but does it represent a sizable change? One way to answer that question
is to explore the probabilities of high blood pressure from our fitted model. Let’s first look at the
predictive margins of the probability of high blood pressure for the three levels of race.
114 svy postestimation — Postestimation tools for svy
Linearized
Margin Std. Err. t P>|t| [95% Conf. Interval]
race
White .3600722 .0150121 23.99 0.000 .3294548 .3906895
Black .4256413 .0211311 20.14 0.000 .3825441 .4687385
Other .4523404 .0311137 14.54 0.000 .3888836 .5157972
Because our response is a probability, these margins are sometimes called predicted marginal
proportions or model-adjusted risks. They let us compare the effect of our three racial groups while
controlling for the distribution of other covariates in the groups. Computationally, these predictive
margins are the weighted average of the predicted probabilities for each observation in the estimation
sample. The marginal probability for whites is the average probability, assuming that everyone in the
sample is white; the margin for blacks assumes that everyone is black; and the margin for others
assumes that everyone is something other than black or white.
There is a sizable difference in blood pressure between whites and blacks, with the marginal
probability of high blood pressure for whites being about 36% and that for blacks being almost 43%.
These are the adjusted probability levels. A more direct answer to our question about whether the odds
ratios represent a substantial effect requires looking at the differences of these marginal probabilities.
Researchers in the health-related sciences call such differences risk differences, whereas researchers
in the social sciences usually call them average marginal effects or average partial effects.
Regardless of terminology, we are interested in the difference in the probability of blacks having
high blood pressure as compared with whites, while adjusting for all other covariates in the model.
We request risk differences by specifying the variables of interest in a dydx() option.
. margins, vce(unconditional) dydx(race)
Average marginal effects Number of obs = 10,351
Expression : Pr(highbp), predict()
dy/dx w.r.t. : 2.race 3.race
Linearized
dy/dx Std. Err. t P>|t| [95% Conf. Interval]
race
Black .0655691 .0204063 3.21 0.003 .0239501 .1071881
Other .0922682 .0343809 2.68 0.012 .0221478 .1623886
Note: dy/dx for factor levels is the discrete change from the base level.
Looking in the column labeled dy/dx, we see that the risk difference between blacks and whites
is about 6.6% (0.6557). That is a sizable as well as significant difference.
Because they are population-weighted averages over the whole sample, these margins are estimates
of the population average risk differences. And because we specified the vce(unconditional)
option, their standard errors and confidence intervals can be used to make inferences about the
population average risk differences. See Methods and formulas in [R] margins for details.
We can also compute margins or risk differences for subpopulations. To compute risk differences
for the four subpopulations that are the regions of the United States—Northeast, Midwest, South,
and West—we add the over(region) option.
svy postestimation — Postestimation tools for svy 115
Linearized
dy/dx Std. Err. t P>|t| [95% Conf. Interval]
2.race
region
NE .0662951 .0207354 3.20 0.003 .0240051 .1085852
MW .065088 .0204357 3.19 0.003 .0234091 .106767
S .0663448 .0202173 3.28 0.003 .0251112 .1075783
W .0647221 .0203523 3.18 0.003 .0232134 .1062308
3.race
region
NE .093168 .0343919 2.71 0.011 .0230253 .1633106
MW .091685 .034247 2.68 0.012 .0218379 .1615322
S .0932303 .0345933 2.70 0.011 .0226769 .1637837
W .0912062 .034322 2.66 0.012 .021206 .1612063
Note: dy/dx for factor levels is the discrete change from the base level.
The differences in the covariate distributions across the regions have little effect on the risk
differences between blacks and whites, or between other races and whites.
Rather than explore the probabilities after logistic regression, we might have explored the hazards
or mean survival times after fitting a survival model. See [R] margins for many more applications of
margins.
Jackknife
Coef. Std. Err. t P>|t| [95% Conf. Interval]
race
White .3600722 .0150128 23.98 0.000 .3294534 .390691
Black .4256413 .0211504 20.12 0.000 .3825048 .4687778
Other .4523404 .0322488 14.03 0.000 .3865684 .5181124
You can see that now the jackknife standard errors are being reported.
svy postestimation — Postestimation tools for svy 117
Linearized
loglead Coef. Std. Err. t P>|t| [95% Conf. Interval]
race
Black .178402 .0314173 5.68 0.000 .114326 .242478
Other -.0516952 .0402381 -1.28 0.208 -.1337614 .030371
region
MW -.02283 .0389823 -0.59 0.562 -.1023349 .0566749
S -.1685453 .056004 -3.01 0.005 -.2827662 -.0543244
W -.0362295 .0387508 -0.93 0.357 -.1152623 .0428032
Given that we modeled the natural log of the lead measurement, we can use predictnl to compute
the exponentiated linear prediction (in the original units of the lead variable), along with its standard
error.
. predictnl leadhat = exp(xb()) if e(sample), se(leadhat_se)
(5,403 missing values generated)
. sort lead leadhat
. generate showobs = inrange(_n,1,5) + inrange(_n,2501,2505) +
> inrange(_n,4945,4948)
118 svy postestimation — Postestimation tools for svy
c.age#
lead leadhat leadhat_se age c.age
For one-dimensional tests, the adjusted and unadjusted F statistics are identical, but they differ for
higher-dimensional tests. Using the nosvyadjust option is not recommended because the unadjusted
F statistic can produce extremely anticonservative p-values (that is, p-values that are too small) when
the variance degrees of freedom (equal to the number of sampled PSUs minus the number of strata)
is not large relative to the dimension of the test.
svy postestimation — Postestimation tools for svy 119
F(df,29) df p
# Bonferroni-adjusted p-values
See Korn and Graubard (1990) for a discussion of these three different procedures for conducting
joint-hypothesis tests. See Eltinge and Sribney (1996) for an earlier implementation of test for
survey data.
Example 7: Contrasts
After svy commands, we can estimate contrasts and make pairwise comparisons with the contrast
and pwcompare commands. First, we will fit a regression of serum zinc levels on health status:
. use http://www.stata-press.com/data/r14/nhanes2f, clear
. label list hlthgrp
hlthgrp:
1 poor
2 fair
3 average
4 good
5 excellent
. svy: regress zinc i.health
(running regress on estimation sample)
Survey: Linear regression
Number of strata = 31 Number of obs = 9,188
Number of PSUs = 62 Population size = 104,162,204
Design df = 31
F( 4, 28) = 15.61
Prob > F = 0.0000
R-squared = 0.0098
Linearized
zinc Coef. Std. Err. t P>|t| [95% Conf. Interval]
health
fair .9272308 .7690396 1.21 0.237 -.6412357 2.495697
average 2.444004 .6407097 3.81 0.001 1.137268 3.75074
good 4.038285 .6830349 5.91 0.000 2.645226 5.431344
excellent 4.770911 .7151641 6.67 0.000 3.312324 6.229498
Higher levels of zinc are associated with better health. We can use reverse adjacent contrasts to
compare each health status with the preceding status.
. contrast ar.health
Contrasts of marginal linear predictions
Design df = 31
Margins : asbalanced
df F P>F
health
(fair vs poor) 1 1.45 0.2371
(average vs fair) 1 5.49 0.0257
(good vs average) 1 10.92 0.0024
(excellent vs good) 1 1.93 0.1744
Joint 4 15.61 0.0000
Design 31
health
(fair vs poor) .9272308 .7690396 -.6412357 2.495697
(average vs fair) 1.516773 .6474771 .1962347 2.837311
(good vs average) 1.594281 .4824634 .6102904 2.578271
(excellent vs good) .7326264 .5270869 -.3423744 1.807627
The first table reports significance tests for each contrast, along with a joint test of all the contrasts.
The row labeled (fair vs poor), for example, tests the null hypothesis that the first two health
statuses have the same mean zinc level. The test statistics are automatically adjusted for the survey
design.
The second table reports estimates, standard errors, and confidence limits for each contrast. The
row labeled (good vs average), for example, shows that those in good health have a mean zinc
level about 1.6 units higher than those of average health. The standard errors and confidence intervals
also account for the survey design.
If we would like to go further and make all possible pairwise comparisons of the health groups,
we can use the pwcompare command. We will specify the mcompare(sidak) option to account for
multiple comparisons and the cformat(%3.1f) option to reduce the number of decimal places in
the output:
svy postestimation — Postestimation tools for svy 121
Number of
Comparisons
health 10
Sidak
Contrast Std. Err. [95% Conf. Interval]
health
fair vs poor 0.9 0.8 -1.4 3.2
average vs poor 2.4 0.6 0.5 4.4
good vs poor 4.0 0.7 2.0 6.1
excellent vs poor 4.8 0.7 2.6 6.9
average vs fair 1.5 0.6 -0.4 3.5
good vs fair 3.1 0.5 1.5 4.8
excellent vs fair 3.8 0.7 1.7 6.0
good vs average 1.6 0.5 0.1 3.0
excellent vs average 2.3 0.7 0.3 4.4
excellent vs good 0.7 0.5 -0.9 2.3
Seven of the ten Šidák intervals exclude the null value of zero. See [R] pwcompare for more
information on pairwise comparisons and multiple-comparison adjustments.
In the NHANES II dataset, we have the variable health containing self-reported health status,
which takes on the values 1–5, with 1 being “poor” and 5 being “excellent”. Because this is an
ordered categorical variable, it makes sense to model it by using svy: ologit. We use some basic
demographic variables as predictors: female (an indicator of female individuals), black (an indicator
for black individuals), age in years, and c.age#c.age (age squared).
. use http://www.stata-press.com/data/r14/nhanes2f, clear
. svyset psuid [pw=finalwgt], strata(stratid)
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: <zero>
. svy: ologit health female black age c.age#c.age
(running ologit on estimation sample)
Survey: Ordered logistic regression
Number of strata = 31 Number of obs = 10,335
Number of PSUs = 62 Population size = 116,997,257
Design df = 31
F( 4, 28) = 223.27
Prob > F = 0.0000
Linearized
health Coef. Std. Err. t P>|t| [95% Conf. Interval]
The self-reported health variable takes five categories. Categories 1 and 2 denote negative
categories, whereas categories 4 and 5 denote positive categories. We wonder whether the distinctions
between the two positive categories and between the two negative categories are produced in accordance
with one latent dimension, which is an assumption of the ordered logistic model. To test one-
dimensionality, we will collapse the five-point health measure into a three-point measure, refit the
ordered logistic model, and compare the regression coefficients and cutpoints between the two analyses.
If the single latent variable assumption is valid, the coefficients and cutpoints should match. This can
be seen as a Hausman-style specification test. Estimation of the ordered logistic model parameters
for survey data is by maximum pseudolikelihood. Neither estimator is fully efficient, and thus the
assumptions for the classic Hausman test and for the hausman command are not satisfied. With
suest, we can obtain an appropriate Hausman test for survey data.
To perform the Hausman test, we are already almost halfway there by following steps 1 and 2 for
one of the models. We just need to store the current estimation results before moving on to the next
model. Here we store the results with estimates store under the name H5, indicating that in this
analysis, the dependent variable health has five categories.
. estimates store H5
svy postestimation — Postestimation tools for svy 123
We proceed by generating a new dependent variable health3, which maps values 1 and 2 into
2, 3 into 3, and 4 and 5 into 4. This transformation is conveniently accomplished with the clip()
function. We then fit an ologit model with this new dependent variable and store the estimation
results under the name H3.
. generate health3 = clip(health, 2, 4)
(2 missing values generated)
. svy: ologit health3 female black age c.age#c.age
(running ologit on estimation sample)
Survey: Ordered logistic regression
Number of strata = 31 Number of obs = 10,335
Number of PSUs = 62 Population size = 116,997,257
Design df = 31
F( 4, 28) = 197.08
Prob > F = 0.0000
Linearized
health3 Coef. Std. Err. t P>|t| [95% Conf. Interval]
. estimates store H3
We can now obtain the combined estimation results of the two models stored under H5 and H3
with design-based standard errors.
124 svy postestimation — Postestimation tools for svy
. suest H5 H3
Simultaneous survey results for H5, H3
Number of strata = 31 Number of obs = 10,335
Number of PSUs = 62 Population size = 116,997,257
Design df = 31
Linearized
Coef. Std. Err. t P>|t| [95% Conf. Interval]
H5_health
female -.1615219 .0523678 -3.08 0.004 -.2683267 -.054717
black -.986568 .0790277 -12.48 0.000 -1.147746 -.8253899
age -.0119491 .0082974 -1.44 0.160 -.0288717 .0049736
H5_cut1
_cons -4.566229 .1632561 -27.97 0.000 -4.899192 -4.233266
H5_cut2
_cons -3.057415 .1699944 -17.99 0.000 -3.404121 -2.710709
H5_cut3
_cons -1.520596 .1714342 -8.87 0.000 -1.870239 -1.170954
H5_cut4
_cons -.242785 .1703965 -1.42 0.164 -.590311 .104741
H3_health3
female -.1551238 .0563809 -2.75 0.010 -.2701133 -.0401342
black -1.046316 .0728274 -14.37 0.000 -1.194849 -.8977836
age -.0365408 .0073653 -4.96 0.000 -.0515624 -.0215192
H3_cut1
_cons -3.655498 .1610211 -22.70 0.000 -3.983903 -3.327093
H3_cut2
_cons -2.109584 .1597057 -13.21 0.000 -2.435306 -1.783862
The coefficients of H3 and H5 look rather similar. We now use test to perform a formal Hausman-
type test for the hypothesis that the regression coefficients are indeed the same, as we would expect
if there is indeed a one-dimensional latent dimension for health. Thus we test that the coefficients in
the equation H5 health are equal to those in H3 health3.
. test [H5_health=H3_health3]
Adjusted Wald test
( 1) [H5_health]female - [H3_health3]female = 0
( 2) [H5_health]black - [H3_health3]black = 0
( 3) [H5_health]age - [H3_health3]age = 0
( 4) [H5_health]c.age#c.age - [H3_health3]c.age#c.age = 0
F( 4, 28) = 17.13
Prob > F = 0.0000
We can reject the null hypothesis, which indicates that the ordered logistic regression model is
indeed misspecified. Another specification test can be conducted with respect to the cutpoints. Variable
health3 was constructed from health by collapsing the two worst categories into value 2 and the
two best categories into value 4. This action effectively has removed two cutpoints, but if the model
svy postestimation — Postestimation tools for svy 125
fits the data, it should not affect the other two cutpoints. The comparison is hampered by a difference
in the names of the cutpoints between the models, as illustrated in the figure below:
Cutpoint /cut2 of model H5 should be compared with cutpoint /cut1 of H3, and similarly, /cut3
of H5 with /cut2 of H3.
. test ([H5_cut2]_cons=[H3_cut1]_cons) ([H5_cut3]_cons=[H3_cut2]_cons)
Adjusted Wald test
( 1) [H5_cut2]_cons - [H3_cut1]_cons = 0
( 2) [H5_cut3]_cons - [H3_cut2]_cons = 0
F( 2, 30) = 33.49
Prob > F = 0.0000
We conclude that the invariance of the cutpoints under the collapse of categories is not supported
by the data, again providing evidence against the reduced specification of the ordered logistic model
in this case.
The calls to ologit now use iweights instead of the svy prefix, and the svy option was added
to suest. No other changes are required.
126 svy postestimation — Postestimation tools for svy
References
Eltinge, J. L., and W. M. Sribney. 1996. svy5: Estimates of linear combinations and hypothesis tests for survey data.
Stata Technical Bulletin 31: 31–42. Reprinted in Stata Technical Bulletin Reprints, vol. 6, pp. 246–259. College
Station, TX: Stata Press.
Graubard, B. I., and E. L. Korn. 2004. Predictive margins with survey data. Biometrics 55: 652–659.
Korn, E. L., and B. I. Graubard. 1990. Simultaneous testing of regression coefficients with complex survey data: Use
of Bonferroni t statistics. American Statistician 44: 270–276.
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Also see
[SVY] svy estimation — Estimation commands for survey data
[SVY] svy brr — Balanced repeated replication for survey data
[SVY] svy bootstrap — Bootstrap for survey data
[SVY] svy jackknife — Jackknife estimation for survey data
[SVY] svy sdr — Successive difference replication for survey data
[SVY] estat — Postestimation statistics for survey data
[U] 13.5 Accessing coefficients and standard errors
[U] 20 Estimation and postestimation commands
Title
svy sdr — Successive difference replication for survey data
Description
svy sdr performs successive difference replication (SDR) estimation of specified statistics (or
expressions) for a Stata command or a user-written command. The command is executed once for
each replicate using sampling weights that are adjusted according to the SDR methodology. Any
Stata estimation command listed in [SVY] svy estimation may be used with svy sdr. User-written
commands that meet the requirements in [P] program properties may also be used.
Quick start
Estimate population mean of v1 using SDR standard-error estimates with sampling weight wvar1 and
replicate weights in variables with prefix rwvar
svyset [pweight=wvar1], sdrweight(rwvar*)
svy sdr _b: mean v1
Same as above
svyset [pweight=wvar1], sdrweight(rwvar*) vce(sdr)
svy: mean v1
SDR estimate of the standard error of the difference between the means of v2 and v3 using either
svyset command above
svy sdr (_b[v2]-_b[v3]): mean v2 v3
As above, but name the result diff and save results from each replication to mydata.dta
svy sdr diff=(_b[v2]-_b[v3]), saving(mydata): mean v2 v3
Same as above
sdr diff=(_b[v2]-_b[v3]), saving(mydata): mean v2 v3
Note: Any estimation command meeting the requirements specified in the Description may be
substituted for mean in the examples above.
Menu
Statistics > Survey data analysis > Resampling > Successive difference replications estimation
127
128 svy sdr — Successive difference replication for survey data
Syntax
svy sdr exp list , svy options sdr options eform option : command
exp list specifies the statistics to be collected from the execution of command. exp list is required
unless command has the svyb program property, in which case exp list defaults to b; see [P] program
properties. The expressions in exp list are assumed to conform to the following:
exp list contains (name: elist)
elist
eexp
elist contains newvarname = (exp)
(exp)
eexp is specname
[eqno]specname
specname is b
b[]
se
se[]
eqno is ##
name
exp is a standard Stata expression; see [U] 13 Functions and expressions.
Distinguish between [ ], which are to be typed, and , which indicate optional arguments.
Options
svy options; see [SVY] svy.
Options
saving( filename , suboptions ) creates a Stata data file (.dta file) consisting of (for each statistic
in exp list) a variable containing the replicates.
double specifies that the results for each replication be stored as doubles, meaning 8-byte reals.
By default, they are stored as floats, meaning 4-byte reals. This option may be used without
the saving() option to compute the variance estimates by using double precision.
every(#) specifies that results be written to disk every #th replication. every() should be specified
in conjunction with saving() only when command takes a long time for each replication.
This will allow recovery of partial results should some other software crash your computer.
See [P] postfile.
replace indicates that filename be overwritten if it exists. This option does not appear in the
dialog box.
mse specifies that svy sdr compute the variance by using deviations of the replicates from the
observed value of the statistics based on the entire dataset. By default, svy sdr computes the
variance by using deviations of the replicates from their mean.
Reporting
verbose requests that the full table legend be displayed.
nodots suppresses display of the replication dots. By default, one dot character is printed for each
successful replication. A red ‘x’ is printed if command returns with an error, and ‘e’ is printed if
one of the values in exp list is missing.
130 svy sdr — Successive difference replication for survey data
noisily requests that any output from command be displayed. This option implies the nodots
option.
trace causes a trace of the execution of command to be displayed. This option implies the noisily
option.
title(text) specifies a title to be displayed above the table of SDR results; the default title is “SDR
results”.
eform option; see [R] eform option. This option is ignored if exp list is not b.
Advanced
nodrop prevents observations outside e(sample) and the if and in qualifiers from being dropped
before the data are resampled.
reject(exp) identifies an expression that indicates when results should be rejected. When exp is
true, the resulting values are reset to missing values.
dof(#) specifies the design degrees of freedom, overriding the default calculation, df = Npsu −Nstrata .
Example 1
The U.S. Census Bureau publishes public-use data from several of its surveys. This data can
be downloaded from http://factfinder.census.gov. We downloaded the American Community Survey
(ACS) Public Use Microdata Sample (PUMS) data collected in 2007. We extracted data for the state of
Texas and kept the variables containing age, sex, and sampling weight for each person in the dataset.
This sample dataset also contains 80 SDR weight variables.
. use http://www.stata-press.com/data/r14/ss07ptx
. svyset
pweight: pwgtp
VCE: sdr
MSE: off
sdrweight: pwgtp1 pwgtp2 pwgtp3 pwgtp4 pwgtp5 pwgtp6 pwgtp7 pwgtp8 pwgtp9
pwgtp10 pwgtp11 pwgtp12 pwgtp13 pwgtp14 pwgtp15 pwgtp16
(output omitted )
pwgtp73 pwgtp74 pwgtp75 pwgtp76 pwgtp77 pwgtp78 pwgtp79
pwgtp80
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
Here we estimate the average age of the males and of the females for our Texas subpopulation.
The standard errors are estimated using SDR.
svy sdr — Successive difference replication for survey data 131
SDR
Over Mean Std. Err. [95% Conf. Interval]
agep
Male 33.24486 .0470986 33.15255 33.33717
Female 35.23908 .0386393 35.16335 35.31481
Stored results
In addition to the results documented in [SVY] svy, svy sdr stores the following in e():
Scalars
e(N reps) number of replications
e(N misreps) number of replications with missing values
e(k exp) number of standard expressions
e(k eexp) number of b/ se expressions
e(k extra) number of extra estimates added to b
Macros
e(cmdname) command name from command
e(cmd) same as e(cmdname) or sdr
e(vce) sdr
e(exp#) #th expression
e(sdrweight) sdrweight() variable list
Matrices
e(b sdr) SDR means
e(V) SDR variance estimates
When exp list is b, svy sdr will also carry forward most of the results already in e() from
command.
Reference
Fay, R. E., and G. F. Train. 1995. Aspects of survey and model-based postcensal estimation of income and poverty
characteristics for states and counties. In Proceedings of the Government Statistics Section, 154–159. American
Statistical Association.
132 svy sdr — Successive difference replication for survey data
Also see
[SVY] svy postestimation — Postestimation tools for svy
[SVY] svy bootstrap — Bootstrap for survey data
[SVY] svy brr — Balanced repeated replication for survey data
[SVY] svy jackknife — Jackknife estimation for survey data
[U] 20 Estimation and postestimation commands
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
Title
svy: tabulate oneway — One-way tables for survey data
Description
svy: tabulate produces one-way tabulations for complex survey data. See [SVY] svy: tabulate
twoway for two-way tabulations for complex survey data.
Quick start
One-way table showing weighted proportions for categories of v1 using svyset data
svy: tabulate v1
Add 95% confidence intervals and weighted counts
svy: tabulate v1, ci count
As above, and display large counts in a more readable format
svy: tabulate v1 ci count format(%11.3g)
Unweighted numbers of observations and weighted proportions for categories of v2
svy: tabulate v2, obs
Weighted proportions and CIs for categories of v3 in the subpopulation defined by v4 > 40
svy, subpop(if v4>40): tabulate v3, ci
Menu
Statistics > Survey data analysis > Tables > One-way tables
133
134 svy: tabulate oneway — One-way tables for survey data
Syntax
Basic syntax
Full syntax
svy vcetype , svy options : tabulate varname if in
, tabulate options display items display options
vcetype Description
SE
linearized Taylor-linearized variance estimation
bootstrap bootstrap variance estimation; see [SVY] svy bootstrap
brr BRR variance estimation; see [SVY] svy brr
jackknife jackknife variance estimation; see [SVY] svy jackknife
sdr SDR variance estimation; see [SVY] svy sdr
Specifying a vcetype overrides the default from svyset.
Options
svy options; see [SVY] svy.
Model
stdize(varname) specifies that the point estimates be adjusted by direct standardization across the
strata identified by varname. This option requires the stdweight() option.
stdweight(varname) specifies the weight variable associated with the standard strata identified in
the stdize() option. The standardization weights must be constant within the standard strata.
136 svy: tabulate oneway — One-way tables for survey data
tab(varname) specifies that counts be cell totals of this variable and that proportions (or percentages)
be relative to (that is, weighted by) this variable. For example, if this variable denotes income, then
the cell “counts” are instead totals of income for each cell, and the cell proportions are proportions
of income for each cell.
missing specifies that missing values in varname be treated as another row category rather than be
omitted from the analysis (the default).
Table items
cell requests that cell proportions (or percentages) be displayed. This is the default if count is not
specified.
count requests that weighted cell counts be displayed.
se requests that the standard errors of cell proportions (the default) or weighted counts be displayed.
When se (or ci, deff, deft, or cv) is specified, only one of cell or count can be selected.
The standard error computed is the standard error of the one selected.
ci requests confidence intervals for cell proportions or weighted counts.
deff and deft request that the design-effect measures DEFF and DEFT be displayed for each cell
proportion or weighted count. See [SVY] estat for details.
The deff and deft options are not allowed with estimation results that used direct standardization
or poststratification.
cv requests that the coefficient of variation be displayed for each cell proportion, count, or row or
column proportion. See [SVY] estat for details.
srssubpop requests that DEFF and DEFT be computed using an estimate of SRS (simple random
sampling) variance for sampling within a subpopulation. By default, DEFF and DEFT are computed
using an estimate of the SRS variance for sampling from the entire population. Typically, srssubpop
would be given when computing subpopulation estimates by strata or by groups of strata.
obs requests that the number of observations for each cell be displayed.
Reporting
level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is
level(95) or as set by set level; see [U] 20.7 Specifying the width of confidence intervals.
proportion, the default, requests that proportions be displayed.
percent requests that percentages be displayed instead of proportions.
nomarginal requests that the column marginal not be displayed.
nolabel requests that variable labels and value labels be ignored.
cellwidth(#), csepwidth(#), and stubwidth(#) specify widths of table elements in the output;
see [P] tabdisp. Acceptable values for the stubwidth() option range from 4 to 32.
format(% fmt) specifies a format for the items in the table. The default is format(%6.0g). See
[U] 12.5 Formats: Controlling how data are displayed.
svy: tabulate uses the tabdisp command (see [P] tabdisp) to produce the table. Only five items
can be displayed in the table at one time. The ci option implies two items. If too many items are
selected, a warning will appear immediately. To view more items, redisplay the table while specifying
different options.
svy: tabulate oneway — One-way tables for survey data 137
Example 1
Here we use svy: tabulate to estimate the distribution of the race category variable from our
NHANES II dataset (McDowell et al. 1981). Before calling svy: tabulate, we use svyset to declare
the survey structure of the data.
. use http://www.stata-press.com/data/r14/nhanes2b
. svyset psuid [pweight=finalwgt], strata(stratid)
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: <zero>
. svy: tabulate race
(running tabulate on estimation sample)
Number of strata = 31 Number of obs = 10,351
Number of PSUs = 62 Population size = 117,157,513
Design df = 31
1=white,
2=black,
3=other proportion
White .8792
Black .0955
Other .0253
Total 1
Here we display weighted counts for each category of race along with the 95% confidence bounds,
as well as the design effects DEFF and DEFT. We also use the format() option to improve the look
of the table.
138 svy: tabulate oneway — One-way tables for survey data
1=white,
2=black,
3=other count lb ub deff deft
Total 117157513
From the above results, we can conclude with 95% confidence that the number of people in the
population that fall within the White category is between 97,060,400 and 108,938,698.
Stored results
In addition to the results documented in [SVY] svy, svy: tabulate stores the following in e():
Scalars
e(r) number of rows e(total) weighted sum of tab() variable
Macros
e(cmd) tabulate e(rowvlab) row variable label
e(tab) tab() variable e(rowvar) varname, the row variable
e(rowlab) label or empty e(setype) cell or count
Matrices
e(Prop) matrix of cell proportions e(V row) variance for row totals
e(Obs) matrix of observation counts e(V srs row) Vsrs for row totals
e(Deff) DEFF vector for e(setype) items e(Deff row) DEFF for row totals
e(Deft) DEFT vector for e(setype) items e(Deft row) DEFT for row totals
e(Row) values for row variable
Margaret E. Martin (1912–2012) is best known for her work developing the U.S. Current Population
Survey (CPS). Martin was born in New York City and had an early love for mathematics. She
received a bachelor’s degree in economics from Barnard College and went on to earn an MA
and a PhD in economics from Columbia University. Martin began her career in the midst of the
Great Depression, working for a New Deal agency in New York to classify employers covered
by the unemployment insurance system. Despite having the third highest score on the qualifying
civil service exam, she almost did not take the job because she “had been trained by economists
primarily, and they had a very low opinion of government work”.
Her work in New York allowed her to later move to the U.S. Bureau of Budget (now the Office
of Management and Budget), where she joined the team that developed the CPS. The majority
of Martin’s work focused on the CPS, a survey of employment and demographics among U.S.
households. She worked to explain differences in previous unemployment survey results derived
from sampling businesses. She also oversaw an effort to improve the reliability of information
from the CPS by adding questions that addressed labor-force participation and the use of paid
and unpaid leave. Today, the CPS is a continuous monthly survey and the primary source of
information about characteristics of the U.S. labor force.
In 1973, Martin became the first executive director of the National Academy of Sciences’
Committee on National Statistics. She was elected president of the American Statistical Association
(ASA) in 1980 and was the first recipient of the ASA’s Founders Award.
Reference
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Also see
[SVY] svy postestimation — Postestimation tools for svy
[SVY] svydescribe — Describe survey data
[R] tabulate oneway — One-way table of frequencies
[SVY] svy: tabulate twoway — Two-way tables for survey data
[U] 20 Estimation and postestimation commands
[SVY] direct standardization — Direct standardization of means, proportions, and ratios
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] svy — The survey prefix command
[SVY] variance estimation — Variance estimation for survey data
Title
svy: tabulate twoway — Two-way tables for survey data
Description
svy: tabulate produces two-way tabulations with tests of independence for complex survey data.
See [SVY] svy: tabulate oneway for one-way tabulations for complex survey data.
Quick start
Two-way table of weighted cell proportions for v1 and v2 using svyset data
svy: tabulate v1 v2
As above, but with a test of independence using Pearson’s χ2 statistic with and without correction
for the complex design
svy: tabulate v1 v2, pearson
Within-row and within-column proportions
svy: tabulate v1 v2, row column
95% confidence intervals for within-column proportions
svy: tabulate v1 v2, column ci
Unweighted numbers of observations and weighted counts
svy: tabulate v1 v2, obs count
As above, but display large counts in a more readable format
svy: tabulate v1 v2, obs count format(%11.0fc)
Weighted counts in the subpopulation defined by v3 > 0
svy, subpop(v3): tabulate v1 v2, count
Menu
Statistics > Survey data analysis > Tables > Two-way tables
140
svy: tabulate twoway — Two-way tables for survey data 141
Syntax
Basic syntax
Full syntax
svy vcetype , svy options : tabulate varname1 varname2 if in
, tabulate options display items display options statistic options
vcetype Description
SE
linearized Taylor-linearized variance estimation
bootstrap bootstrap variance estimation; see [SVY] svy bootstrap
brr BRR variance estimation; see [SVY] svy brr
jackknife jackknife variance estimation; see [SVY] svy jackknife
sdr SDR variance estimation; see [SVY] svy sdr
Specifying a vcetype overrides the default from svyset.
Options
svy options; see [SVY] svy.
Model
stdize(varname) specifies that the point estimates be adjusted by direct standardization across the
strata identified by varname. This option requires the stdweight() option.
stdweight(varname) specifies the weight variable associated with the standard strata identified in
the stdize() option. The standardization weights must be constant within the standard strata.
tab(varname) specifies that counts be cell totals of this variable and that proportions (or percentages)
be relative to (that is, weighted by) this variable. For example, if this variable denotes income, the
cell “counts” are instead totals of income for each cell, and the cell proportions are proportions
of income for each cell.
missing specifies that missing values in varname1 and varname2 be treated as another row or column
category rather than be omitted from the analysis (the default).
Table items
cell requests that cell proportions (or percentages) be displayed. This is the default if none of count,
row, or column is specified.
count requests that weighted cell counts be displayed.
column or row requests that column or row proportions (or percentages) be displayed.
se requests that the standard errors of cell proportions (the default), weighted counts, or row or
column proportions be displayed. When se (or ci, deff, deft, or cv) is specified, only one of
cell, count, row, or column can be selected. The standard error computed is the standard error
of the one selected.
ci requests confidence intervals for cell proportions, weighted counts, or row or column proportions.
The confidence intervals are constructed using a logit transform so that their endpoints always lie
between 0 and 1.
deff and deft request that the design-effect measures DEFF and DEFT be displayed for each cell
proportion, count, or row or column proportion. See [SVY] estat for details. The mean generalized
DEFF is also displayed when deff, deft, or subpop is requested; see Methods and formulas for
an explanation.
The deff and deft options are not allowed with estimation results that used direct standardization
or poststratification.
144 svy: tabulate twoway — Two-way tables for survey data
cv requests that the coefficient of variation be displayed for each cell proportion, count, or row or
column proportion. See [SVY] estat for details.
srssubpop requests that DEFF and DEFT be computed using an estimate of SRS (simple random
sampling) variance for sampling within a subpopulation. By default, DEFF and DEFT are computed
using an estimate of the SRS variance for sampling from the entire population. Typically, srssubpop
would be given when computing subpopulation estimates by strata or by groups of strata.
obs requests that the number of observations for each cell be displayed.
Reporting
level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is
level(95) or as set by set level; see [U] 20.7 Specifying the width of confidence intervals.
proportion, the default, requests that proportions be displayed.
percent requests that percentages be displayed instead of proportions.
vertical requests that the endpoints of confidence intervals be stacked vertically on display.
nomarginals requests that row and column marginals not be displayed.
nolabel requests that variable labels and value labels be ignored.
notable prevents the header and table from being displayed in the output. When specified, only the
results of the requested test statistics are displayed. This option may not be specified with any
other option in display options except the level() option.
cellwidth(#), csepwidth(#), and stubwidth(#) specify widths of table elements in the output;
see [P] tabdisp. Acceptable values for the stubwidth() option range from 4 to 32.
format(% fmt) specifies a format for the items in the table. The default is format(%6.0g). See
[U] 12.5 Formats: Controlling how data are displayed.
Test statistics
pearson requests that the Pearson χ2 statistic be computed. By default, this is the test of independence
that is displayed. The Pearson χ2 statistic is corrected for the survey design with the second-order
correction of Rao and Scott (1984) and is converted into an F statistic. One term in the correction
formula can be calculated using either observed cell proportions or proportions under the null
hypothesis (that is, the product of the marginals). By default, observed cell proportions are used.
If the null option is selected, then a statistic corrected using proportions under the null hypothesis
is displayed as well.
lr requests that the likelihood-ratio test statistic for proportions be computed. This statistic is not
defined when there are one or more zero cells in the table. The statistic is corrected for the survey
design by using the same correction procedure that is used with the pearson statistic. Again either
observed cell proportions or proportions under the null hypothesis can be used in the correction
formula. By default, the former is used; specifying the null option gives both the former and the
latter. Neither variant of this statistic is recommended for sparse tables. For nonsparse tables, the
lr statistics are similar to the corresponding pearson statistics.
null modifies the pearson and lr options only. If null is specified, two corrected statistics are
displayed. The statistic labeled “D-B (null)” (“D-B” stands for design-based) uses proportions
under the null hypothesis (that is, the product of the marginals) in the Rao and Scott (1984)
correction. The statistic labeled merely “Design-based” uses observed cell proportions. If null is
not specified, only the correction that uses observed proportions is displayed.
svy: tabulate twoway — Two-way tables for survey data 145
wald requests a Wald test of whether observed weighted counts equal the product of the marginals
(Koch, Freeman, and Freeman 1975). By default, an adjusted F statistic is produced; an unadjusted
statistic can be produced by specifying noadjust. The unadjusted F statistic can yield extremely
anticonservative p-values (that is, p-values that are too small) when the degrees of freedom of the
variance estimates (the number of sampled PSUs minus the number of strata) are small relative
to the (R − 1)(C − 1) degrees of freedom of the table (where R is the number of rows and C
is the number of columns). Hence, the statistic produced by wald and noadjust should not be
used for inference unless it is essentially identical to the adjusted statistic.
This option must be specified at run time in order to be used on subsequent calls to svy to report
results.
llwald requests a Wald test of the log-linear model of independence (Koch, Freeman, and Free-
man 1975). The statistic is not defined when there are one or more zero cells in the table. The
adjusted statistic (the default) can produce anticonservative p-values, especially for sparse tables,
when the degrees of freedom of the variance estimates are small relative to the degrees of freedom of
the table. Specifying noadjust yields a statistic with more severe problems. Neither the adjusted
nor the unadjusted statistic is recommended for inference; the statistics are made available only
for pedagogical purposes.
noadjust modifies the wald and llwald options only. It requests that an unadjusted F statistic be
displayed in addition to the adjusted statistic.
svy: tabulate uses the tabdisp command (see [P] tabdisp) to produce the table. Only five items
can be displayed in the table at one time. The ci option implies two items. If too many items are
selected, a warning will appear immediately. To view more items, redisplay the table while specifying
different options.
Introduction
Despite the long list of options for svy: tabulate, it is a simple command to use. Using the
svy: tabulate command is just like using tabulate to produce two-way tables for ordinary data.
The main difference is that svy: tabulate computes a test of independence that is appropriate for
complex survey data.
The test of independence that is displayed by default is based on the usual Pearson χ2 statistic
for two-way tables. To account for the survey design, the statistic is turned into an F statistic with
noninteger degrees of freedom by using a second-order Rao and Scott (1981, 1984) correction.
Although the theory behind the Rao and Scott correction is complicated, the p-value for the corrected
F statistic can be interpreted in the same way as a p-value for the Pearson χ2 statistic for “ordinary”
data (that is, data that are assumed independent and identically distributed [i.i.d.]).
146 svy: tabulate twoway — Two-way tables for survey data
svy: tabulate, in fact, computes four statistics for the test of independence with two variants
of each, for a total of eight statistics. The option combination for each of the eight statistics are the
following:
1. pearson (the default)
2. pearson null
3. lr
4. lr null
5. wald
6. wald noadjust
7. llwald
8. llwald noadjust
The wald and llwald options with noadjust yield the statistics developed by Koch, Freeman, and
Freeman (1975), which have been implemented in the CROSSTAB procedure of the SUDAAN software
(Research Triangle Institute 1997, release 7.5).
These eight statistics, along with other variants, have been evaluated in simulations (Sribney 1998).
On the basis of these simulations, we advise researchers to use the default statistic (the pearson
option) in all situations. We recommend that the other statistics be used only for comparative or
pedagogical purposes. Sribney (1998) gives a detailed comparison of the statistics; a summary of his
conclusions is provided later in this entry.
Other than the test-statistic options (statistic options) and the survey design options (svy options),
most of the other options of svy: tabulate simply relate to different choices for what can be
displayed in the body of the table. By default, cell proportions are displayed, but viewing either row
or column proportions or weighted counts usually makes more sense.
Standard errors and confidence intervals can optionally be displayed for weighted counts or cell,
row, or column proportions. The confidence intervals for proportions are constructed using a logit
transform so that their endpoints always lie between 0 and 1. Associated design effects (DEFF and
DEFT) can be viewed for the variance estimates. The mean generalized DEFF (Rao and Scott 1984)
is also displayed when option deff, deft, or srssubpop is specified. The mean generalized DEFF
is essentially a design effect for the asymptotic distribution of the test statistic; see the Methods and
formulas section at the end of this entry.
Example 1
Using data from the Second National Health and Nutrition Examination Survey (NHANES II)
(McDowell et al. 1981), we identify the survey design characteristics with svyset and then produce
a two-way table of cell proportions with svy: tabulate.
svy: tabulate twoway — Two-way tables for survey data 147
. use http://www.stata-press.com/data/r14/nhanes2b
. svyset psuid [pweight=finalwgt], strata(stratid)
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: <zero>
. svy: tabulate race diabetes
(running tabulate on estimation sample)
Number of strata = 31 Number of obs = 10,349
Number of PSUs = 62 Population size = 117,131,111
Design df = 31
1=white,
2=black, diabetes, 1=yes, 0=no
3=other 0 1 Total
The default table displays only cell proportions, and this makes it difficult to compare the incidence
of diabetes in white, black, and “other” racial groups. It would be better to look at row proportions.
This can be done by redisplaying the results (that is, reissuing the command without specifying any
variables) with the row option.
. svy: tabulate, row
Number of strata = 31 Number of obs = 10,349
Number of PSUs = 62 Population size = 117,131,111
Design df = 31
This table is much easier to interpret. A larger proportion of blacks have diabetes than do whites
or persons in the “other” racial category. The test of independence for a two-way contingency table
is equivalent to the test of homogeneity of row (or column) proportions. Hence, we can conclude
that there is a highly significant difference between the incidence of diabetes among the three racial
groups.
148 svy: tabulate twoway — Two-way tables for survey data
We may now wish to compute confidence intervals for the row proportions. If we try to redisplay,
specifying ci along with row, we get the following result:
. svy: tabulate, row ci
confidence intervals are only available for cells to compute row confidence
intervals, rerun command with row and ci options
r(111);
There are limits to what svy: tabulate can redisplay. Basically, any of the options relating to
variance estimation (that is, se, ci, deff, and deft) must be specified at run time along with the
single item (that is, count, cell, row, or column) for which you want standard errors, confidence
intervals, DEFF, or DEFT. So to get confidence intervals for row proportions, we must rerun the
command. We do so below, requesting not only ci but also se.
. svy: tabulate race diabetes, row se ci format(%7.4f)
(running tabulate on estimation sample)
Number of strata = 31 Number of obs = 10,349
Number of PSUs = 62 Population size = 117,131,111
Design df = 31
1=white,
2=black, diabetes, 1=yes, 0=no
3=other 0 1 Total
In the above table, we specified a %7.4f format rather than using the default %6.0g format.
The single format applies to every item in the table. We can omit the marginal totals by specifying
nomarginals. If the above style for displaying the confidence intervals is obtrusive—and it can be
in a wider table—we can use the vertical option to stack the endpoints of the confidence interval,
one over the other, and omit the brackets (the parentheses around the standard errors are also omitted
when vertical is specified). To express results as percentages, as with the tabulate command (see
[R] tabulate twoway), we can use the percent option. Or we can play around with these display
options until we get a table that we are satisfied with, first making changes to the options on redisplay
(that is, omitting the cross-tabulated variables when we issue the command).
svy: tabulate twoway — Two-way tables for survey data 149
Technical note
The standard errors computed by svy: tabulate are the same as those produced by svy: mean,
svy: proportion, and svy: ratio. Indeed, svy: tabulate uses these commands as subroutines
to produce its table.
In the previous example, the estimate of the proportion of African Americans with diabetes (the
second proportion in the second row of the preceding table) is simply a ratio estimate; hence, we can
also obtain the same estimates by using svy: ratio:
. drop black
. generate black = (race==2) if !missing(race)
. generate diablk = diabetes*black
(2 missing values generated)
. svy: ratio diablk/black
(running ratio on estimation sample)
Survey: Ratio estimation
Number of strata = 31 Number of obs = 10,349
Number of PSUs = 62 Population size = 117,131,111
Design df = 31
_ratio_1: diablk/black
Linearized
Ratio Std. Err. [95% Conf. Interval]
Although the standard errors are the same, the confidence intervals are slightly different. The
svy: tabulate command produced the confidence interval [ 0.0477, 0.0729 ], and svy: ratio
gave [ 0.0465, 0.0716 ]. The difference is because svy: tabulate uses a logit transform to produce
confidence intervals whose endpoints are always between 0 and 1. This transformation also shifts the
confidence intervals slightly toward 0.5, which is beneficial because the untransformed confidence
intervals tend to be, on average, biased away from 0.5. See Methods and formulas for details.
Race
Gender White Black Other Total
where m is the total number of sampled individuals, pbrc is the estimated proportion for the cell in the
rth row and cth column of the table, and pb0rc is the estimated proportion under the null hypothesis of
PC
independence; that is, pb0rc = pbr· pb·c , the product of the row and column marginals: pbr· = c=1 pbrc
PR
and pb·c = r=1 pbrc .
For i.i.d. data, both these statistics are distributed asymptotically as χ2(R−1)(C−1) . The likelihood-
ratio statistic is not defined when one or more of the cells in the table are empty. The Pearson statistic,
however, can be calculated when one or more cells in the table are empty—the statistic may not have
good properties in this case, but the statistic still has a computable value.
svy: tabulate twoway — Two-way tables for survey data 151
Wald statistics
Prior to the work by Rao and Scott (1981, 1984), Wald tests for the test of independence for
two-way tables were developed by Koch, Freeman, and Freeman (1975). Two Wald statistics have
been proposed. The first, similar to the Pearson statistic, is based on
brc − N
Ybrc = N br· N
b·c /N
b··
where N brc is the estimated weighted count for the r, cth cell. The delta method can be used to
approximate the variance of Ybrc , and a Wald statistic can be calculated as usual. A second Wald
statistic can be constructed based on a log-linear model for the table. Like the likelihood-ratio statistic,
this statistic is undefined when there is a zero proportion in the table.
These Wald statistics are initially χ2 statistics, but they have better properties when converted
into F statistics with denominator degrees of freedom that account for the degrees of freedom of the
variance estimator. They can be converted to F statistics in two ways.
One method is the standard manner: divide by the χ2 degrees of freedom d0 = (R − 1)(C − 1)
to get an F statistic with d0 numerator degrees of freedom and ν = n − L denominator degrees of
freedom. This is the form of the F statistic suggested by Koch, Freeman, and Freeman (1975) and
implemented in the CROSSTAB procedure of the SUDAAN software (Research Triangle Institute 1997,
release 7.5), and it is the method used by svy: tabulate when the noadjust option is specified
with wald or llwald.
Another technique is to adjust the F statistic by using
Fadj = (ν − d0 + 1)W/(νd0 ) with Fadj ∼ F (d0 , ν − d0 + 1)
This is the default adjustment for svy: tabulate. test and the other svy estimation com-
mands produce adjusted F statistics by default, using the same adjustment procedure. See Korn
and Graubard (1990) for a justification of the procedure.
152 svy: tabulate twoway — Two-way tables for survey data
The adjusted F statistic is identical to the unadjusted F statistic when d0 = 1, that is, for 2 × 2
tables.
As Thomas and Rao (1987) point out (also see Korn and Graubard [1990]), the unadjusted
F statistics can become extremely anticonservative as d0 increases when ν is small or moderate;
that is, under the null, the statistics are “significant” far more often than they should be. Because
the unadjusted statistics behave so poorly for larger tables when ν is not large, their use can be
justified only for small tables or when ν is large. But when the table is small or when ν is large,
the unadjusted statistic is essentially identical to the adjusted statistic. Hence, for statistical inference,
looking at the unadjusted statistics has no point.
The adjusted “Pearson” Wald F statistic usually behaves reasonably under the null. However, even
the adjusted F statistic for the log-linear Wald test tends to be moderately anticonservative when ν
is not large (Thomas and Rao 1987; Sribney 1998).
Example 3
With the NHANES II data, we tabulate, for the male subpopulation, high blood pressure (highbp)
versus a variable (sizplace) that indicates the degree of urbanity/ruralness. We request that all eight
statistics for the test of independence be displayed.
. use http://www.stata-press.com/data/r14/nhanes2b
. generate male = (sex==1) if !missing(sex)
. svy, subpop(male): tabulate highbp sizplace, col obs pearson lr null wald
> llwald noadj
(running tabulate on estimation sample)
Number of strata = 31 Number of obs = 10,351
Number of PSUs = 62 Population size = 117,157,513
Subpop. no. obs = 4,915
Subpop. size = 56,159,480
Design df = 31
1 if BP >
140/90, 0 1=urban,..., 8=rural
otherwise 1 2 3 4 5 6 7 8 Total
Total 1 1 1 1 1 1 1 1 1
526 607 622 445 222 230 371 1892 4915
Wald (Pearson):
Unadjusted chi2(7) = 21.2704
Unadjusted F(7, 31) = 3.0386 P = 0.0149
Adjusted F(7, 25) = 2.4505 P = 0.0465
Wald (log-linear):
Unadjusted chi2(7) = 25.7644
Unadjusted F(7, 31) = 3.6806 P = 0.0052
Adjusted F(7, 25) = 2.9683 P = 0.0208
The p-values from the null-corrected Pearson and likelihood-ratio statistics (lines labeled “D-B
(null)”; “D-B” stands for “design-based”) are bigger than the corresponding default-corrected statistics
(lines labeled “Design-based”). Simulations (Sribney 1998) show that the null-corrected statistics are
overly conservative for many sparse tables (except 2 × 2 tables); this appears to be the case here,
although this table is hardly sparse. The default-corrected Pearson statistic has good properties under
the null for both sparse and nonsparse tables; hence, the smaller p-value for it should be considered
reliable.
The default-corrected likelihood-ratio statistic is usually similar to the default-corrected Pearson
statistic except for sparse tables, when it tends to be anticonservative. This example follows this
pattern, with its p-value being slightly smaller than that of the default-corrected Pearson statistic.
For tables of these dimensions (2 × 8), the unadjusted “Pearson” Wald and log-linear Wald
F statistics are extremely anticonservative under the null when the variance degrees of freedom is
small. Here the variance degrees of freedom is only 31 (62 PSUs minus 31 strata), so we expect that
the unadjusted Wald F statistics yield smaller p-values than the adjusted F statistics. Because of
their poor behavior under the null for small variance degrees of freedom, they cannot be trusted here.
Simulations show that although the adjusted “Pearson” Wald F statistic has good properties under
the null, it is often less powerful than the default Rao and Scott–corrected statistics. That is probably
the explanation for the larger p-value for the adjusted “Pearson” Wald F statistic than that for the
default-corrected Pearson and likelihood-ratio statistics.
The p-value for the adjusted log-linear Wald F statistic is about the same as that for the trustworthy
default-corrected Pearson statistic. However, that is probably because of the anticonservatism of the
log-linear Wald under the null balancing out its lower power under alternative hypotheses.
The “uncorrected” χ2 Pearson and likelihood-ratio statistics displayed in the table are misspecified
statistics; that is, they are based on an i.i.d. assumption, which is not valid for complex survey data.
Hence, they are not correct, even asymptotically. The “unadjusted” Wald χ2 statistics, on the other
hand, are completely different. They are valid asymptotically as the variance degrees of freedom
becomes large.
pearson null is the Rao and Scott second-order corrected Pearson statistic, computed using pb0rc in
the correction. It is numerically similar to the pearson statistic for nonsparse tables. For sparse
tables, it can be erratic. Under the null, it can be anticonservative for sparse 2 × 2 tables but
conservative for larger sparse tables.
lr is the Rao and Scott second-order corrected likelihood-ratio statistic, computed using pbrc in the
correction (default correction). The correction is identical to that for pearson. It is numerically
similar to the pearson statistic for nonsparse tables. It can be anticonservative (p-values too small)
in sparse tables. If there is a zero cell, it cannot be computed.
lr null is the Rao and Scott second-order corrected likelihood-ratio statistic, computed using pb0rc
in the correction. The correction is identical to that for pearson null. It is numerically similar
to the lr statistic for nonsparse tables. For sparse tables, it can be overly conservative. If there is
a zero cell, it cannot be computed.
wald statistic is the adjusted “Pearson” Wald F statistic. It has good properties under the null for
nonsparse tables. It can be erratic for sparse 2 × 2 tables and some sparse large tables. The pearson
statistic often appears to be more powerful.
wald noadjust is the unadjusted “Pearson” Wald F statistic. It can be extremely anticonservative
under the null when the table degrees of freedom (number of rows minus one times the number of
columns minus one) approaches the variance degrees of freedom (number of sampled PSUs minus
the number of strata). It is the same as the adjusted wald statistic for 2 × 2 tables. It is similar
to the adjusted wald statistic for small tables, large variance degrees of freedom, or both.
llwald statistic is the adjusted log-linear Wald F statistic. It can be anticonservative for both sparse
and nonsparse tables. If there is a zero cell, it cannot be computed.
llwald noadjust statistic is the unadjusted log-linear Wald F statistic. Like wald noadjust, it
can be extremely anticonservative under the null when the table degrees of freedom approaches
the variance degrees of freedom. It also suffers from the same general anticonservatism of the
llwald statistic. If there is a zero cell, it cannot be computed.
Stored results
In addition to the results documented in [SVY] svy, svy: tabulate stores the following in e():
Scalars
e(r) number of rows e(c) number of columns
e(cvgdeff) c.v. of generalized DEFF eigenval- e(mgdeff) mean generalized DEFF
ues
e(total) weighted sum of tab() variable
e(F Pear) default-corrected Pearson F e(F Penl) null-corrected Pearson F
e(df1 Pear) numerator d.f. for e(F Pear) e(df1 Penl) numerator d.f. for e(F Penl)
e(df2 Pear) denominator d.f. for e(F Pear) e(df2 Penl) denominator d.f. for e(F Penl)
e(p Pear) p-value for e(F Pear) e(p Penl) p-value for e(F Penl)
e(cun Pear) uncorrected Pearson χ2 e(cun Penl) null variant uncorrected Pearson χ2
e(F LR) default-corrected likelihood-ratio F e(F LRnl) null-corrected likelihood-ratio F
e(df1 LR) numerator d.f. for e(F LR) e(df1 LRnl) numerator d.f. for e(F LRnl)
e(df2 LR) denominator d.f. for e(F LR) e(df2 LRnl) denominator d.f. for e(F LRnl)
e(p LR) p-value for e(F LR) e(p LRnl) p-value for e(F LRnl)
e(cun LR) uncorrected likelihood-ratio χ2 e(cun LRln) null variant uncorrected
likelihood-ratio χ2
e(F Wald) adjusted “Pearson” Wald F e(F LLW) adjusted log-linear Wald F
e(p Wald) p-value for e(F Wald) e(p LLW) p-value for e(F LLW)
e(Fun Wald) unadjusted “Pearson” Wald F e(Fun LLW) unadjusted log-linear Wald F
e(pun Wald) p-value for e(Fun Wald) e(pun LLW) p-value for e(Fun LLW)
e(cun Wald) unadjusted “Pearson” Wald χ2 e(cun LLW) unadjusted log-linear Wald χ2
svy: tabulate twoway — Two-way tables for survey data 155
Macros
e(cmd) tabulate e(colvlab) column variable label
e(tab) tab() variable e(rowvar) varname1 , the row variable
e(rowlab) label or empty e(colvar) varname2 , the column variable
e(collab) label or empty e(setype) cell, count, column, or row
e(rowvlab) row variable label
Matrices
e(Prop) matrix of cell proportions e(V col) variance for column totals
e(Obs) matrix of observation counts e(V srs row) Vsrs for row totals
e(Deff) DEFF vector for e(setype) items e(V srs col) Vsrs for column totals
e(Deft) DEFT vector for e(setype) items e(Deff row) DEFF for row totals
e(Row) values for row variable e(Deff col) DEFF for column totals
e(Col) values for column variable e(Deft row) DEFT for row totals
e(V row) variance for row totals e(Deft col) DEFT for column totals
Let
C
X R
X R X
X C
N
br· = N
brc , N
b·c = N
brc , and N
b·· = N
brc
c=1 r=1 r=1 c=1
N
brc is a total, the proportion estimators are ratios, and their variances can be estimated using
linearization methods as outlined in [SVY] variance estimation. svy: tabulate computes the variance
estimates by using svy: mean, svy: ratio, and svy: total.
156 svy: tabulate twoway — Two-way tables for survey data
Confidence intervals
Confidence intervals for proportions are calculated using a logit transform so that the endpoints
lie between 0 and 1. Let pb be an estimated proportion and sb be an estimate of its standard error. Let
pb
f (b
p) = ln
1 − pb
be the logit transform of the proportion. In this metric, an estimate of the standard error is
sb
SE p)} = f 0 (b
c {f (b p)b
s =
pb(1 − pb)
where t1−α/2,ν is the (1 − α/2)th quantile of Student’s t distribution with ν degrees of freedom.
The endpoints of this confidence interval are transformed back to the proportion metric by using the
inverse of the logit transform
ey
f −1 (y) =
1 + ey
Hence, the displayed confidence intervals for proportions are
−1 pb t1−α/2,ν sb
f ln ±
1 − pb pb(1 − pb)
Confidence intervals for weighted counts are untransformed and are identical to the intervals produced
by svy: total.
R X
X C
2
XP2 = m prc − pb0rc ) /b
(b p0rc
r=1 c=1
R X
X C
2
XLR = 2m pbrc ln (b
prc /b
p0rc )
r=1 c=1
where m is the total number of sampled individuals, pbrc is the estimated proportion for the cell in the
rth row and cth column of the table as defined earlier, and pb0rc is the estimated proportion under the
null hypothesis of independence; that is, pb0rc = pbr· pb·c , the product of the row and column marginals.
svy: tabulate twoway — Two-way tables for survey data 157
Rao and Scott (1981, 1984) show that, asymptotically, XP2 and XLR
2
are distributed as
(R−1)(C−1)
X
X2 ∼ δ k Wk (1)
k=1
where the Wk are independent χ21 variables and the δk are the eigenvalues of
e 0 Vsrs X
∆ = (X e 2 )−1 (X
e 0 VX
e 2) (2)
2 2
where V is the variance of the pbrc under the survey design and Vsrs is the variance of the pbrc that
you would have if the design were simple random sampling; namely, Vsrs has diagonal elements
prc (1 − prc )/m and off-diagonal elements −prc pst /m.
X
e 2 is calculated as follows. Rao and Scott do their development in a log-linear modeling context,
so consider [ 1 | X1 | X2 ] as predictors for the cell counts of the R × C table in a log-linear model.
The X1 matrix of dimension RC × (R + C − 2) contains the R − 1 “main effects” for the rows
and the C − 1 “main effects” for the columns. The X2 matrix of dimension RC × (R − 1)(C − 1)
contains the row and column “interactions”. Hence, fitting [ 1 | X1 | X2 ] gives the fully saturated
model (that is, fits the observed values perfectly) and [ 1 | X1 ] gives the independence model. The
X
e 2 matrix is the projection of X2 onto the orthogonal complement of the space spanned by the
columns of X1 , where the orthogonality is defined with respect to Vsrs ; that is, Xe 0 Vsrs X1 = 0.
2
See Rao and Scott (1984) for the proof justifying (1) and (2). However, even without a full
understanding, you can get a feeling for ∆. It is like a ratio (although remember that it is a matrix) of
two variances. The variance in the numerator involves the variance under the true survey design, and
the variance in the denominator involves the variance assuming that the design was simple random
sampling. The design effect DEFF for an estimated proportion (see [SVY] estat) is defined as
Vb (b
prc )
DEFF =
Vsrsor (e
e prc )
Hence, ∆ can be regarded as a design-effects matrix, and Rao and Scott call its eigenvalues, the δk s,
the “generalized design effects”.
Computing an estimate for ∆ by using estimates for V and Vsrs is easy. Rao and Scott (1984)
derive a simpler formula for ∆
b:
These corrected statistics are asymptotically distributed as χ2(R−1)(C−1) . Thus, to first-order, you can
view the i.i.d. statistics XP2 and XLR
2
as being “too big” by a factor of δb· for true survey design.
A better second-order correction can be obtained by using the Satterthwaite approximation to the
distribution of a weighted sum of χ21 variables. Here the Pearson statistic becomes
XP2
XP2 (δb· , b
a) = (3)
a2 + 1)
δb· (b
a is the coefficient of variation of the eigenvalues:
where b
P b2
δk
a2 =
b −1
(R − 1)(C − 1)δb·2
Because
Pb
δk = tr ∆ b 2 , (3) can be written in an easily computable form as
b and P δb2 = tr ∆
k
tr ∆
b
XP2 (δb· , b
a) = X2
b2 P
tr ∆
These corrected statistics are asymptotically distributed as χ2d , with
(R − 1)(C − 1) b 2
(tr ∆)
d= 2
=
a +1
b b2
tr ∆
that is, a χ2 with, in general, noninteger degrees of freedom. The likelihood-ratio statistic XLR
2
can
also be given this second-order correction in an identical manner.
Two issues remain. First, there are two possible ways to compute the variance estimate Vbsrs ,
which is used to compute ∆ b . Vsrs has diagonal elements prc (1 − prc )/m and off-diagonal elements
−prc pst /m, but here prc is the true, not estimated, proportion. Hence, the question is what to use
to estimate prc : the observed proportions, pbrc , or the proportions estimated under the null hypothesis
of independence, pb0rc = pbr· pb·c ? Rao and Scott (1984, 53) leave this as an open question.
Because of the question of using pbrc or pb0rc to compute Vbsrs , svy: tabulate can compute both
corrections. By default, when the null option is not specified, only the correction based on pbrc is
displayed. If null is specified, two corrected statistics and corresponding p-values are displayed, one
computed using pbrc and the other using pb0rc .
The second outstanding issue concerns the degrees of freedom resulting from the variance estimate,
Vb , of the cell proportions under the survey design. The customary degrees of freedom for t statistics
resulting from this variance estimate is ν = n − L, where n is the number of PSUs in the sample
and L is the number of strata.
Rao and Thomas (1989) suggest turning the corrected χ2 statistic into an F statistic by dividing
it by its degrees of freedom, d0 = (R − 1)(C − 1). The F statistic is then taken to have numerator
degrees of freedom equal to d0 and denominator degrees of freedom equal to νd0 . Hence, the corrected
Pearson F statistic is
svy: tabulate twoway — Two-way tables for survey data 159
XP2 b 2
(tr ∆)
FP = with FP ∼ F (d, νd) where d = and ν = n − L (4)
tr ∆
b b2
tr ∆
This is the corrected statistic that svy: tabulate displays by default or when the pearson option
is specified. When the lr option is specified, an identical correction is produced for the likelihood-ratio
2
statistic XLR . When null is specified, (4) is also used. For the statistic labeled “D-B (null)”, ∆ b is
computed using pb0rc . For the statistic labeled “Design-based”, ∆ is computed using pbrc .
b
The Wald statistics computed by svy: tabulate with the wald and llwald options were developed
by Koch, Freeman, and Freeman (1975). The statistic given by the wald option is similar to the
Pearson statistic because it is based on
brc − N
Ybrc = N br· N
b·c /N
b··
The statistic given by the llwald option is based on the log-linear model with predictors [1|X1 |X2 ]
that was mentioned earlier. This Wald statistic is
0 −1 0
WLL = X02 lnp b X02 Jp Vb (b p)Jp 0 X2
X2 lnp
b
The other svy estimators also use this adjustment procedure for F statistics. See Korn and
Graubard (1990) for a justification of the procedure.
References
Fuller, W. A., W. J. Kennedy, Jr., D. Schnell, G. Sullivan, and H. J. Park. 1986. PC CARP. Software package. Ames,
IA: Statistical Laboratory, Iowa State University.
Jann, B. 2008. Multinomial goodness-of-fit: Large-sample tests with survey design correction and exact tests for small
samples. Stata Journal 8: 147–169.
Koch, G. G., D. H. Freeman, Jr., and J. L. Freeman. 1975. Strategies in the multivariate analysis of data from
complex surveys. International Statistical Review 43: 59–78.
Korn, E. L., and B. I. Graubard. 1990. Simultaneous testing of regression coefficients with complex survey data: Use
of Bonferroni t statistics. American Statistician 44: 270–276.
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
160 svy: tabulate twoway — Two-way tables for survey data
Rao, J. N. K., and A. J. Scott. 1981. The analysis of categorical data from complex sample surveys: Chi-squared
tests for goodness of fit and independence in two-way tables. Journal of the American Statistical Association 76:
221–230.
. 1984. On chi-squared tests for multiway contingency tables with cell proportions estimated from survey data.
Annals of Statistics 12: 46–60.
Rao, J. N. K., and D. R. Thomas. 1989. Chi-squared tests for contingency tables. In Analysis of Complex Surveys,
ed. C. J. Skinner, D. Holt, and T. M. F. Smith, 89–114. New York: Wiley.
Research Triangle Institute. 1997. SUDAAN User’s Manual, Release 7.5. Research Triangle Park, NC: Research
Triangle Institute.
Sribney, W. M. 1998. svy7: Two-way contingency tables for survey or clustered data. Stata Technical Bulletin 45:
33–49. Reprinted in Stata Technical Bulletin Reprints, vol. 8, pp. 297–322. College Station, TX: Stata Press.
Thomas, D. R., and J. N. K. Rao. 1987. Small-sample comparisons of level and power for simple goodness-of-fit
statistics under cluster sampling. Journal of the American Statistical Association 82: 630–636.
Also see
[SVY] svy postestimation — Postestimation tools for svy
[SVY] svydescribe — Describe survey data
[R] tabulate twoway — Two-way table of frequencies
[R] test — Test linear hypotheses after estimation
[SVY] svy: tabulate oneway — One-way tables for survey data
[U] 20 Estimation and postestimation commands
[SVY] direct standardization — Direct standardization of means, proportions, and ratios
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] svy — The survey prefix command
[SVY] variance estimation — Variance estimation for survey data
Title
svydescribe — Describe survey data
Description
svydescribe displays a table that describes the strata and the sampling units for a given sampling
stage in a survey dataset.
Menu
Statistics > Survey data analysis > Setup and utilities > Describe survey data
Syntax
svydescribe varlist if in , options
options Description
Main
stage(#) sampling stage to describe; default is stage(1)
finalstage display information per sampling unit in the final stage
single display only the strata with one sampling unit
generate(newvar) generate a variable identifying strata with one sampling unit
svydescribe requires that the survey design variables be identified using svyset; see [SVY] svyset.
Options
Main
stage(#) specifies the sampling stage to describe. The default is stage(1).
finalstage specifies that results be displayed for each sampling unit in the final sampling stage;
that is, a separate line of output is produced for every sampling unit in the final sampling stage.
This option is not allowed with stage(), single, or generate().
single specifies that only the strata containing one sampling unit be displayed in the table.
generate(newvar) stores a variable that identifies strata containing one sampling unit for a given
sampling stage.
161
162 svydescribe — Describe survey data
svydescribe will display the strata and PSU arrangement of the dataset.
. svydescribe
Survey: Describing stage 1 sampling units
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: <zero>
#Obs per Unit
Our NHANES II dataset has 31 strata (stratum 19 is missing) and two PSUs per stratum.
The hdresult variable contains serum levels of high-density lipoprotein (HDL). If we try to
estimate the mean of hdresult, we get a missing value for the standard-error estimate and a note
explaining why.
. svy: mean hdresult
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 31 Number of obs = 8,720
Number of PSUs = 60 Population size = 98,725,345
Design df = 29
Linearized
Mean Std. Err. [95% Conf. Interval]
hdresult 49.67141 . . .
Running svydescribe with hdresult and the single option will show which strata have only one
PSU.
. svydescribe hdresult, single
Survey: Describing strata with a single sampling unit in stage 1
pweight: finalwgt
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: <zero>
#Obs with #Obs with #Obs per included Unit
#Units #Units complete missing
Stratum included omitted data data min mean max
Both stratid = 1 and stratid = 2 have only one PSU with nonmissing values of hdresult.
Because this dataset has only 62 PSUs, the finalstage option produces a manageable amount of
output:
164 svydescribe — Describe survey data
1 1 0 215
1 2 114 51
2 1 98 20
2 2 0 67
(output omitted )
32 2 203 8
31 62 8,720 1,631
10,351
It is rather striking that there are two PSUs with no values for hdresult. All other PSUs have only
a moderate number of missing values. Obviously, here a data analyst should first try to ascertain why
these data are missing. The answer here (C. L. Johnson, 1995, pers. comm.) is that HDL measurements
could not be collected until the third survey location. Thus there are no hdresult data for the first
two locations: stratid = 1, psuid = 1 and stratid = 2, psuid = 2.
Assuming that we wish to go ahead and analyze the hdresult data, we must collapse strata—that
is, merge them—so that every stratum has at least two PSUs with some nonmissing values. We can
accomplish this by collapsing stratid = 1 into stratid = 2. To perform the stratum collapse, we
create a new strata identifier, newstr, and a new PSU identifier, newpsu.
. generate newstr = stratid
. generate newpsu = psuid
. replace newpsu = psuid + 2 if stratid == 1
(380 real changes made)
. replace newstr = 2 if stratid == 1
(380 real changes made)
2 1 98 20
2 2 0 67
2 3 0 215
2 4 114 51
3 1 161 38
3 2 116 33
(output omitted )
32 1 180 59
32 2 203 8
30 62 8,720 1,631
10,351
The new stratum, newstr = 2, has four PSUs, two of which contain some nonmissing values of
hdresult. This is sufficient to allow us to estimate the mean of hdresult and get a nonmissing
standard-error estimate.
. svy: mean hdresult
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 30 Number of obs = 8,720
Number of PSUs = 60 Population size = 98,725,345
Design df = 30
Linearized
Mean Std. Err. [95% Conf. Interval]
Linearized
Mean Std. Err. [95% Conf. Interval]
hdresult 49.67141 . . .
References
Eltinge, J. L., and W. M. Sribney. 1996. svy3: Describing survey data: Sampling design and missing data. Stata
Technical Bulletin 31: 23–26. Reprinted in Stata Technical Bulletin Reprints, vol. 6, pp. 235–239. College Station,
TX: Stata Press.
McDowell, A., A. Engel, J. T. Massey, and K. Maurer. 1981. Plan and operation of the Second National Health and
Nutrition Examination Survey, 1976–1980. Vital and Health Statistics 1(15): 1–144.
Also see
[SVY] svy — The survey prefix command
[SVY] svyset — Declare survey design for dataset
[SVY] survey — Introduction to survey commands
[SVY] variance estimation — Variance estimation for survey data
Title
svymarkout — Mark observations for exclusion on the basis of survey characteristics
Description
svymarkout is a programmer’s command that resets the values of markvar to contain 0 wherever
any of the survey-characteristic variables (previously set by svyset) contain missing values.
Syntax
svymarkout markvar
Example 1
program mysvyprogram, ...
...
syntax ...
marksample touse
svymarkout ‘touse’
...
end
Stored results
svymarkout stores the following in s():
Macros
s(weight) weight variable set by svyset
Also see
[P] mark — Mark observations for inclusion
[P] program properties — Properties of user-defined programs
167
Title
svyset — Declare survey design for dataset
Description
svyset manages the survey analysis settings of a dataset. You use svyset to designate variables
that contain information about the survey design, such as the sampling units and weights. svyset
is also used to specify other design characteristics, such as the number of sampling stages and the
sampling method, and analysis defaults, such as the method for variance estimation. You must svyset
your data before using any svy command; see [SVY] svy estimation.
svyset without arguments reports the current settings. svyset, clear removes the current survey
settings.
Quick start
One-stage design with sampling weight wvar1, strata defined by levels of svar, and sampling units
identified by su1
svyset su1 [pweight=wvar1], strata(svar)
Two-stage design with finite population correction fpc and n indicating second-stage sampling units
are the sampled individuals
svyset su1 [pweight=wvar1], strata(svar) fpc(fpc) || _n
Two-stage design with second-stage clustering defined by su2
svyset su1 [pweight=wvar1], strata(svar) fpc(fpc) || su2
Jackknife variance estimation as the default for svy commands, with sampling weight wvar2, and
replicate-weight variables rwvar*
svyset [pweight=wvar2], vce(jackknife) jkrweight(rwvar*)
As above, but use the MSE formula
svyset [pweight=wvar2], vce(jackknife) jkrweight(rwvar*) mse
Display current survey settings
svyset
Clear current survey settings
svyset, clear
Menu
Statistics > Survey data analysis > Setup and utilities > Declare survey design for dataset
168
svyset — Declare survey design for dataset 169
Syntax
Single-stage design
svyset psu weight , design options options
Multiple-stage design
svyset psu weight , design options || ssu, design options . . . options
psu identifies the primary sampling units and may be n or varname. In the single-stage syntax, psu
is optional and defaults to n.
n indicates that individuals were randomly sampled if the design does not involve clustered
sampling.
varname contains identifiers for the clusters in a clustered sampling design.
ssu is n or varname containing identifiers for sampling units (clusters) in subsequent stages of the
survey design.
n indicates that individuals were randomly sampled within the last sampling stage.
options Description
Weights
brrweight(varlist) balanced repeated replicate (BRR) weights
fay(#) Fay’s adjustment
bsrweight(varlist) bootstrap replicate weights
bsn(#) bootstrap mean-weight adjustment
jkrweight(varlist, . . . ) jackknife replicate weights
sdrweight(varlist, . . . ) successive difference replicate (SDR) weights
SE
vce(linearized) Taylor linearized variance estimation
vce(bootstrap) bootstrap variance estimation
vce(brr) BRR variance estimation
vce(jackknife) jackknife variance estimation
vce(sdr) SDR variance estimation
dof(#) design degrees of freedom
mse use the MSE formula with vce(bootstrap), vce(brr),
vce(jackknife), or vce(sdr)
singleunit(method) strata with a single sampling unit; method may be missing,
certainty, scaled, or centered
Poststratification
poststrata(varname) variable identifying poststrata
postweight(varname) poststratum population sizes
clear clear all settings from the data
noclear change some of the settings without clearing the others
clear(opnames) clear specified settings without clearing all others; opnames may be
one or more of weight, vce, dof, mse, bsrweight, brrweight,
jkrweight, sdrweight, or poststrata
pweights and iweights are allowed; see [U] 11.1.6 weight.
The full specification for jkrweight() is
jkrweight(varlist , stratum(# # . . . ) fpc(# # . . . ) multiplier(# # . . . ) reset )
The full specification for sdrweight() is
sdrweight(varlist , fpc(#) )
clear, noclear, and clear() are not shown in the dialog box.
Options
Main
strata(varname) specifies the name of a variable (numeric or string) that contains stratum identifiers.
fpc(varname) requests a finite population correction for the variance estimates. If varname has
values less than or equal to 1, it is interpreted as a stratum sampling rate fh = nh /Nh , where
nh = number of units sampled from stratum h and Nh = total number of units in the population
belonging to stratum h. If varname has values greater than or equal to nh , it is interpreted as
containing Nh . It is an error for varname to have values between 1 and nh or to have a mixture
of sampling rates and stratum sizes.
svyset — Declare survey design for dataset 171
weight(varname) specifies a stage-level sampling weight variable. For most models, stage-level
sampling weights are multiplied together to create a single observation-level sampling weight
variable used for weighted estimation. For commands such as gsem and meglm, each stage-level
weight variable is assumed to correspond with a hierarchical group level in the model and is used
to compute the pseudolikelihood at that associated group level. Stage-level sampling weights are
required to be constant within their corresponding group level. For examples of fitting a multilevel
model with stage-level sampling weights, see example 5 and example 6 in [ME] meglm.
Weights
brrweight(varlist) specifies the replicate-weight variables to be used with vce(brr) or with svy
brr.
fay(#) specifies Fay’s adjustment (Judkins 1990). The value specified in fay(#) is used to adjust
the BRR weights and is present in the BRR variance formulas.
The sampling weight of the selected PSUs for a given replicate is multiplied by 2-#, where the
sampling weight for the unselected PSUs is multiplied by #. When brrweight(varlist) is specified,
the replicate-weight variables in varlist are assumed to be adjusted using #.
fay(0) is the default and is equivalent to the original BRR method. # must be between 0 and 2,
inclusive, and excluding 1. fay(1) is not allowed because this results in unadjusted weights.
bsrweight(varlist) specifies the replicate-weight variables to be used with vce(bootstrap) or
with svy bootstrap.
bsn(#) specifies that # bootstrap replicate-weight variables were used to generate each bootstrap
mean-weight variable specified in the bsrweight() option. The default is bsn(1). The value
specified in bsn(#) is used to adjust the variance estimate to account for mean bootstrap weights.
jkrweight(varlist, . . . ) specifies the replicate-weight variables to be used with vce(jackknife)
or with svy jackknife.
The following options set characteristics on the jackknife replicate-weight variables. If one value
is specified, all the specified jackknife replicate-weight variables will be supplied with the same
characteristic. If multiple values are specified, each replicate-weight variable will be supplied with
the corresponding value according to the order specified. These options are not shown in the dialog
box.
stratum(# # . . . ) specifies an identifier for the stratum in which the sampling weights have
been adjusted.
fpc(# # . . . ) specifies the FPC value to be added as a characteristic of the jackknife
replicate-weight variables. The values set by this suboption have the same interpretation as
the fpc(varname) option.
multiplier(# # . . . ) specifies the value of a jackknife multiplier to be added as a characteristic
of the jackknife replicate-weight variables.
reset indicates that the characteristics for the replicate-weight variables may be overwritten or
reset to the default, if they exist.
sdrweight(varlist, . . . ) specifies the replicate-weight variables to be used with vce(sdr) or with
svy sdr.
fpc(#) specifies the FPC value associated with the SDR weights. The value set by this suboption
has the same interpretation as the fpc(varname) option. This option is not shown in the dialog
box.
172 svyset — Declare survey design for dataset
SE
vce(vcetype) specifies the default method for variance estimation; see [SVY] variance estimation.
vce(linearized) sets the default to Taylor linearization.
vce(bootstrap) sets the default to the bootstrap; also see [SVY] svy bootstrap.
vce(brr) sets the default to BRR; also see [SVY] svy brr.
vce(jackknife) sets the default to the jackknife; also see [SVY] svy jackknife.
vce(sdr) sets the default to the SDR; also see [SVY] svy sdr.
dof(#) specifies the design degrees of freedom, overriding the default calculation, df = Npsu −Nstrata .
mse specifies that the MSE formula be used when vce(bootstrap), vce(brr), vce(jackknife),
or vce(sdr) is specified. This option requires vce(bootstrap), vce(brr), vce(jackknife),
or vce(sdr).
singleunit(method) specifies how to handle strata with one sampling unit.
singleunit(missing) results in missing values for the standard errors and is the default.
singleunit(certainty) causes strata with single sampling units to be treated as certainty units.
Certainty units contribute nothing to the standard error.
singleunit(scaled) results in a scaled version of singleunit(certainty). The scaling factor
comes from using the average of the variances from the strata with multiple sampling units for
each stratum with one sampling unit.
singleunit(centered) specifies that strata with one sampling unit are centered at the grand
mean instead of the stratum mean.
Poststratification
poststrata(varname) specifies the name of the variable (numeric or string) that contains poststratum
identifiers. See [SVY] poststratification for more information.
postweight(varname) specifies the name of the numeric variable that contains poststratum population
totals (or sizes), that is, the number of elementary sampling units in the population within each
poststratum. See [SVY] poststratification for more information.
The following options are available with svyset but are not shown in the dialog box:
clear clears all the settings from the data. Typing
. svyset, clear
clears the survey design characteristics from the data in memory. Although this option may be
specified with some of the other svyset options, it is redundant because svyset automatically
clears the previous settings before setting new survey design characteristics.
noclear allows some of the options in options to be changed without clearing all the other settings.
This option is not allowed with psu, ssu, design options, or clear.
clear(opnames) allows some of the options in options to be cleared without clearing all the other
settings. opnames refers to an option name and may be one or more of the following:
weight vce dof mse brrweight bsrweight jkrweight sdrweight
poststrata
This option implies the noclear option.
svyset — Declare survey design for dataset 173
The output from svyset states that there are no sampling weights (each observation is given a
sampling weight of 1), there is only one stratum (which is the same as no stratification), and the
PSUs are the observed individuals.
Suppose that su2 identifies the clusters of individuals sampled in the second stage.
. svyset su1 [pweight=pw], fpc(fpc1) || su2, fpc(fpc2)
pweight: pw
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: su1
FPC 1: fpc1
Strata 2: <one>
SU 2: su2
FPC 2: fpc2
Stratification can take place in one or both of the sampling stages. Suppose that strata identifies
the second-stage strata and the first stage was not stratified.
. svyset su1 [pweight=pw], fpc(fpc1) || su2, fpc(fpc2) strata(strata)
pweight: pw
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: su1
FPC 1: fpc1
Strata 2: strata
SU 2: su2
FPC 2: fpc2
svyset — Declare survey design for dataset 175
Use n for ssu in the last stage if the individuals are sampled within the third stage of clustered
sampling.
. svyset su1 [pweight=pw], fpc(fpc1) strata(strata)
> || su2, fpc(fpc2)
> || su3, fpc(fpc3)
> || _n
pweight: pw
VCE: linearized
Single unit: missing
Strata 1: strata
SU 1: su1
FPC 1: fpc1
Strata 2: <one>
SU 2: su2
FPC 2: fpc2
Strata 3: <one>
SU 3: su3
FPC 3: fpc3
Strata 4: <one>
SU 4: <observations>
FPC 4: <zero>
Example 5
Consider the following dataset:
. use http://www.stata-press.com/data/r14/fpc
. list
1. 1 1 3 5 15 2.8
2. 1 2 3 5 15 4.1
3. 1 3 3 5 15 6.8
4. 1 4 3 5 15 6.8
5. 1 5 3 5 15 9.2
6. 2 1 4 3 12 3.7
7. 2 2 4 3 12 6.6
8. 2 3 4 3 12 4.2
Here the variable nh is the number of PSUs per stratum that were sampled, Nh is the total number of
PSUs per stratum in the sampling frame (that is, the population), and x is our survey item of interest.
If we wish to use a finite population correction in our computations, we must svyset an FPC
variable when we specify the variables for sampling weights, PSUs, and strata. The FPC variable
typically contains the number of sampling units per stratum in the population; Nh is our FPC variable.
Here we estimate the population mean of x assuming sampling without replacement.
. svyset psuid [pweight=weight], strata(stratid) fpc(Nh)
pweight: weight
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: Nh
. svy: mean x
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 2 Number of obs = 8
Number of PSUs = 8 Population size = 27
Design df = 6
Linearized
Mean Std. Err. [95% Conf. Interval]
We must respecify the survey design before estimating the population mean of x assuming sampling
with replacement.
. svyset psuid [pweight=weight], strata(stratid)
pweight: weight
VCE: linearized
Single unit: missing
Strata 1: stratid
SU 1: psuid
FPC 1: <zero>
svyset — Declare survey design for dataset 177
. svy: mean x
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 2 Number of obs = 8
Number of PSUs = 8 Population size = 27
Design df = 6
Linearized
Mean Std. Err. [95% Conf. Interval]
Including an FPC always reduces the variance estimate. However, the reduction in the variance estimates
will be small when the Nh are large relative to the nh .
Rather than having a variable that represents the total number of PSUs per stratum in the sampling
frame, we sometimes have a variable that represents a sampling rate fh = nh /Nh . The syntax for
svyset is the same whether the FPC variable contains Nh or fh . The survey variance-estimation
routines in Stata are smart enough to identify what type of FPC information has been specified. If
the FPC variable is less than or equal to 1, it is interpreted as a sampling rate; if it is greater than
or equal to nh , it is interpreted as containing Nh . It is an error for the FPC variable to have values
between 1 and nh or to have a mixture of sampling rates and stratum sizes.
Example 6
Consider the two-stage design where PSUs are sampled with replacement and individuals are
sampled without replacement within the selected PSUs. Sampling the individuals with replacement
would change some of the details in the following discussion, but the result would be the same.
Our population contains 100 PSUs, with five individuals in each, so our population size is 500.
We will sample 10 PSUs with replacement and then sample two individuals without replacement from
within each selected PSU. This results in a dataset with 10 PSUs, each with 2 observations, for a total
of 20 observations. If our dataset contained the PSU information in variable su1 and the second-stage
FPC information in variable fpc2, our svyset command would be as follows.
. use http://www.stata-press.com/data/r14/svyset_wr
. svyset su1 || _n, fpc(fpc2)
Note: Stage 1 is sampled with replacement; further stages will be ignored for
variance estimation.
pweight: <none>
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: su1
FPC 1: <zero>
178 svyset — Declare survey design for dataset
As expected, svyset tells us that it is ignoring the second-stage information because the first-stage
units were sampled with replacement. Because we do not have an FPC variable for the first stage, we
can regard the sampling of PSUs as a series of independently and identically distributed draws. The
second-sampled PSU is drawn independently from the first and has the same sampling distribution
because the first-sampled PSU is eligible to be sampled again.
Consider the following alternative scenario. Because there are 10 ways to pick two people of five,
let’s expand the 100 PSUs to form 100 × 10 = 1,000 “new PSUs” (NPSUs), each of size 2, representing
all possible two-person groups that can be sampled from the original 100 groups of five people. We
now have a population of 1,000 × 2 = 2,000 “new people”; each original person was replicated four
times. We can select 10 NPSUs with replacement to end up with a dataset consisting of 10 groups of
two to form samples of 20 people. If our “new” dataset contained the PSU information in variable
nsu1, our svyset command would be as follows:
. svyset nsu1
pweight: <none>
VCE: linearized
Single unit: missing
Strata 1: <one>
SU 1: nsu1
FPC 1: <zero>
There is nothing from a sampling standpoint to distinguish between our two scenarios. The
information contained in the variables su1 and nsu1 is equivalent; thus svyset can behave as if our
dataset came from the second scenario.
The following questions may spring to mind after reading the above:
• The population in the first scenario has 500 people; the second has 2,000. Does that not
invalidate the comparison between the two scenarios?
Although the populations are different, the sampling schemes described for each scenario result
in the same sampling space. By construction, each possible sample from the first scenario is
also a possible sample from the second scenario. For the first scenario, the number of possible
samples of 10 of 100 PSUs sampled with replacement, where two of five individuals are sampled
without replacement, is
10
10 5
100 × = 1030
2
For the second scenario, the number of possible samples of 10 of 1,000 NPSUs sampled with
replacement, where each NPSU is sampled as a whole, is
1,00010 = 1030
• Does the probability of being in the sample not depend on what happens in the first sampling
stage?
Not when the first stage is sampled with replacement. Sampling with replacement means that
all PSUs have the same chance of being selected even after one of the PSUs has been selected.
Thus each of the two-person groups that can possibly be sampled has the same chance of being
sampled even after a specific two-person group has been selected.
• Is it valid to have replicated people in the population like the one in the second scenario?
Yes, because each person in the population can be sampled more than once. Sampling with
replacement allows us to construct the replicated people.
svyset — Declare survey design for dataset 179
Replication-weight variables
Many groups that collect survey data for public use have taken steps to protect the privacy of
the survey participants. This may result in datasets that have replicate-weight variables instead of
variables that identify the strata and sampling units from the sampling stages. These datasets require
replication methods for variance estimation.
The brrweight(), jkrweight(), bsrweight(), and sdrweight() options allow svyset to
identify the set of replication weights for use with BRR, jackknife, bootstrap, and SDR variance
estimation (svy brr, svy jackknife, svy bootstrap, and svy sdr), respectively. In addition to
the weight variables, svyset also allows you to change the default variance estimation method from
linearization to BRR, jackknife, bootstrap, or SDR.
Example 7
Here are two simple examples using jackknife replication weights.
1. Data containing only sampling weights and jackknife replication weights, and we set the default
variance estimator to the jackknife:
. use http://www.stata-press.com/data/r14/stage5a_jkw
. svyset [pweight=pw], jkrweight(jkw_*) vce(jackknife)
pweight: pw
VCE: jackknife
MSE: off
jkrweight: jkw_1 jkw_2 jkw_3 jkw_4 jkw_5 jkw_6 jkw_7 jkw_8 jkw_9
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
2. Data containing only sampling weights and jackknife replication weights, and we set the default
variance estimator to the jackknife by using the MSE formula:
. svyset [pweight=pw], jkrweight(jkw_*) vce(jackknife) mse
pweight: pw
VCE: jackknife
MSE: on
jkrweight: jkw_1 jkw_2 jkw_3 jkw_4 jkw_5 jkw_6 jkw_7 jkw_8 jkw_9
Single unit: missing
Strata 1: <one>
SU 1: <observations>
FPC 1: <zero>
• A jackknife multiplier used in the formula for variance estimation. The multiplier for the
standard leave-one-out jackknife method is
nh − 1
nh
where nh is the number of PSUs sampled from stratum h. We use the multiplier() suboption
to set these values. The default is derived from the above formula, assuming that nh is equal
to the number of replicate-weight variables for stratum h.
Because of privacy concerns, public survey datasets may not contain stratum-specific information.
However, the population size and an overall jackknife multiplier will probably be provided. You must
then supply this information to svyset for the jackknife replicate-weight variables. We will use the
1999–2000 NHANES data to illustrate how to set these characteristics.
The NHANES datasets for years 1999–2000 are available for download from the Centers for Disease
Control and Prevention (CDC) website, http://www.cdc.gov. This particular release of the NHANES data
contains jackknife replication weights in addition to the usual PSU and stratum information. These
variables are contained in the demographic dataset. In our web browser, we saved the demographic data
from the CDC website ftp://ftp.cdc.gov/pub/Health Statistics/NCHS/nhanes/1999-2000/DEMO.xpt. We
suggest that you rename the data to demo.xpt.
The 1999–2000 NHANES datasets are distributed in SAS Transport format, so we use Stata’s
import sasxport command to read the data into memory. Because of the nature of the survey
design, the demographic dataset demo.xpt has two sampling-weight variables. wtint2yr contains
the sampling weights appropriate for the interview data, and wtmec2yr contains the sampling weights
appropriate for the Mobile Examination Center (MEC) exam data. Consequently, there are two sets of
jackknife replicate-weight variables. The jackknife replicate-weight variables for the interview data
are named wtirep01, wtirep02, . . . , wtirep52. The jackknife replicate-weight variables for the
MEC exam data are named wtmrep01, wtmrep02, . . . , wtmrep52. The documentation published with
the NHANES data gives guidance on which weight variables to use.
. import sasxport demo.xpt
. describe wtint2yr wtmec2yr wtirep01 wtmrep01
storage display value
variable name type format label variable label
The number of PSUs in the NHANES population is not apparent, so we will not set an FPC value, but
we can set the standard jackknife multiplier for the 52 replicate-weight variables and save the results
as a Stata dataset for future use. Also the NHANES datasets all contain a variable called seqn. This
variable has a respondent sequence number that allows the dataset users to merge the demographic
dataset with other 1999–2000 NHANES datasets, so we sort on seqn before saving demo99 00.dta.
svyset — Declare survey design for dataset 181
To complete this example, we will perform a simple analysis using the blood pressure data;
however, before we can perform any analysis, we have to merge the blood pressure dataset, bpx.xpt,
with our demographic dataset, demo99 00.dta. In our web browser, we saved the blood pressure
data from the CDC website ftp://ftp.cdc.gov/pub/Health Statistics/NCHS/nhanes/1999-2000/BPX.xpt.
We suggest that you rename the data to bpx.xpt.
We can then use import sasxport to read in the blood pressure data, sort on seqn, and save
the resulting dataset to bpx99 00.dta. We read in our copy of the demographic data, drop the
irrelevant weight variables, and merge in the blood pressure data from bpx99 00.dta. A quick call
to tabulate on the merge variable generated by merge indicates that 683 observations in the
demographic data are not present in the blood pressure data. We do not drop these observations;
otherwise, the estimate of the population size will be incorrect. Finally, we set the appropriate sampling
and replicate-weight variables with svyset before replacing bpx99 00.dta with a more complete
copy of the blood pressure data.
. import sasxport bpx.xpt
. sort seqn
. save bpx99_00
file bpx99_00.dta saved
. use demo99_00
. drop wtint?yr wtirep*
. merge 1:1 seqn using bpx99_00
Result # of obs.
. drop _merge
. svyset [pw=wtmec2yr], jkrweight(wtmrep*) vce(jackknife)
(output omitted )
. save bpx99_00, replace
file bpx99_00.dta saved
Having saved our merged dataset (with svysettings), we estimate the mean systolic blood pressure
for the population, using the MEC exam replication weights for jackknife variance estimation.
182 svyset — Declare survey design for dataset
Jackknife
Mean Std. Err. [95% Conf. Interval]
. drop _merge
. svyset sdmvpsu [pw=wtmec2yr], strata(sdmvstra)
pweight: wtmec2yr
VCE: linearized
Single unit: missing
Strata 1: sdmvstra
SU 1: sdmvpsu
FPC 1: <zero>
. save bpx01_02, replace
file bpx01_02.dta saved
The demographic dataset for 2001–2002 does not contain replicate-weight variables, but there are
variables that provide information on PSUs and strata for variance estimation. The PSU information
is contained in sdmvpsu, and the stratum information is in sdmvstra. See the documentation that
comes with the NHANES datasets for the details regarding these variables.
This new blood pressure dataset (bpx01 02.dta) is all we need if we are interested in analyzing
blood pressure data only for 2001–2002. However, we want to use the 1999–2002 combined data,
so we will follow the advice in the guidelines and just combine the datasets from the two surveys.
For those concerned about overlapping stratum identifiers between the two survey datasets, it is a
simple exercise to check that sdmvstra ranges from 1 to 13 for 1999–2000 but ranges from 14 to
28 for 2001–2002. Thus the stratum identifiers do not overlap, so we can simply append the data.
The 2001–2002 NHANES demographic dataset has no jackknife replicate-weight variables, so
we drop the replicate-weight variables from the 1999–2000 dataset. The sampling-weight variable
wtmec2yr is no longer appropriate for use with the combined data because its values are based on
the survey designs individually, so we drop it from the combined dataset. Finally, we use svyset
to identify the design variables for the combined surveys. wtmec4yr is the sampling-weight variable
for the MEC exam data developed by the data producers for the combined 1999–2002 NHANES data.
. use bpx99_00
. drop wt?rep*
. append using bpx01_02
. drop wtmec2yr
. svyset sdmvpsu [pw=wtmec4yr], strata(sdmvstra)
pweight: wtmec4yr
VCE: linearized
Single unit: missing
Strata 1: sdmvstra
SU 1: sdmvpsu
FPC 1: <zero>
. save bpx99_02
file bpx99_02.dta saved
Now we can estimate the mean systolic blood pressure for our population by using the combined
surveys and jackknife variance estimation.
184 svyset — Declare survey design for dataset
Jackknife
Mean Std. Err. [95% Conf. Interval]
Video example
Specifying the design of your survey data to Stata
Stored results
svyset stores the following in r():
Scalars
r(stages) number of sampling stages
r(stages wt) last stage containing stage-level weights
Macros
r(wtype) weight type
r(wexp) weight expression
r(wvar) weight variable name
r(weight#) variable identifying weight for stage #
r(su#) variable identifying sampling units for stage #
r(strata#) variable identifying strata for stage #
r(fpc#) FPC for stage #
r(bsrweight) bsrweight() variable list
r(bsn) bootstrap mean-weight adjustment
r(brrweight) brrweight() variable list
r(fay) Fay’s adjustment
r(jkrweight) jkrweight() variable list
r(sdrweight) sdrweight() variable list
r(sdrfpc) fpc() value from within sdrweight()
r(vce) vcetype specified in vce()
r(dof) dof() value
r(mse) mse, if specified
r(poststrata) poststrata() variable
r(postweight) postweight() variable
r(settings) svyset arguments to reproduce the current settings
r(singleunit) singleunit() setting
svyset — Declare survey design for dataset 185
References
Cochran, W. G. 1977. Sampling Techniques. 3rd ed. New York: Wiley.
Judkins, D. R. 1990. Fay’s method for variance estimation. Journal of Official Statistics 6: 223–239.
O’Donnell, O., E. van Doorslaer, A. Wagstaff, and M. Lindelow. 2008. Analyzing Health Equity Using Household
Survey Data: A Guide to Techniques and Their Implementation. Washington, DC: The World Bank.
Also see
[SVY] svy — The survey prefix command
[SVY] svydescribe — Describe survey data
[SVY] survey — Introduction to survey commands
[SVY] poststratification — Poststratification for survey data
[SVY] subpopulation estimation — Subpopulation estimation for survey data
[SVY] variance estimation — Variance estimation for survey data
Title
variance estimation — Variance estimation for survey data
Description
Stata’s suite of estimation commands for survey data use the most commonly used variance estima-
tion techniques: bootstrap, balanced repeated replication, jackknife, successive difference replication,
and linearization. The bootstrap, balanced repeated replication, jackknife, and successive difference
replication techniques are known as replication methods in the survey literature. We stick with that
nomenclature here, but note that these techniques are also known as resampling methods. This entry
discusses the details of these variance estimation techniques.
Also see Cochran (1977), Wolter (2007), and Shao and Tu (1995) for some background on these
variance estimators.
186
variance estimation — Variance estimation for survey data 187
Nh
L X
X
M= Mhi
h=1 i=1
is the number of individuals in the population. Let Yhij be a survey item for individual (h, i, j); for
example, Yhij might be income for adult j living in block i of county h. The associated population
total is
XL XNh MX hi
Y = Yhij
h=1 i=1 j=1
Let yhij denote the items for individuals who are members of the sampled PSUs; here h = 1,
. . . , L; i = 1, . . . , nh ; and j = 1, . . . , mhi . The number of individuals in the sample (number of
observations) is
XL Xnh
m= mhi
h=1 i=1
where whij is a sampling weight, and its unadjusted value for this design is whij = Nh /nh . The
estimator for the number of individuals in the population (population size) is
nh X
L X
X mhi
M
c= whij
h=1 i=1 j=1
188 variance estimation — Variance estimation for survey data
The factor (1 − fh ) is the FPC for stratum h, and fh is the sampling rate for stratum h. The sampling
rate fh is derived from the variable specified in the fpc() option of svyset. If an FPC variable is
not svyset, then fh = 0. If an FPC variable is set and its values are greater than or equal to nh ,
then the variable is assumed to contain the values of Nh , and fh is given by fh = nh /Nh . If its
values are less than or equal to 1, then the variable is assumed to contain the sampling rates fh .
If multiple variables are supplied to svy: total, covariances are also computed. The estimator
for the covariance between Yb and X b (notation for X is defined similarly to that of Y ) is
L hn
X nh X
Cov(
d Yb , X)
b = (1 − fh ) (yhi − y h )(xhi − xh )
nh − 1 i=1
h=1
M= Mhij
h=1 i=1 j=1
variance estimation — Variance estimation for survey data 189
be the population size. Let Yhijk be a survey item for individual (h, i, j, k); for example, Yhijk might
be income for adult k living in block j of county i of state h. The associated population total is
X Nh M
L X Xhi M
Xhij
Y = Yhijk
h=1 i=1 j=1 k=1
Let yhijk denote the items for individuals who are members of the sampled SSUs; here h = 1,
. . . , L; i = 1, . . . , nh ; j = 1, . . . , mhi ; and k = 1, . . . , mhij . The number of observations is
nh X
L X
X mhi
m= mhij
h=1 i=1 j=1
Yb = whijk yhijk
h=1 i=1 j=1 k=1
where whijk is a sampling weight, and its unadjusted value for this design is
Nh Mhi
whijk =
nh mhi
The estimator for the population size is
X mhi m
nh X
L X X hij
M
c= whijk
h=1 i=1 j=1 k=1
where yhi is the weighted total for PSU (h, i); y h is the mean of the PSU totals for stratum h; yhij
is the weighted total for SSU (h, i, j),
mhij
X
yhij = whijk yhijk
k=1
and y hi is the mean of the SSU totals for PSU (h, i),
mhi
1 X
y hi = yhij
mhi j=1
190 variance estimation — Variance estimation for survey data
Equation (2) is equivalent to (1) with an added term representing the increase in variability because
of the second stage of sampling. The factor (1 − fh ) is the FPC, and fh is the sampling rate for the
first stage of sampling. The factor (1 − fhi ) is the FPC, and fhi is the sampling rate for PSU (h, i).
The sampling rate fhi is derived in the same manner as fh .
If multiple variables are supplied to svy: total, covariances are also computed. For estimated
totals Yb and X
b (notation for X is defined similarly to that of Y ), the covariance estimator is
L n
h
X nh X
Cov(
d Yb , X)
b = (1 − fh ) (yhi − y h )(xhi − xh )
nh − 1 i=1
h=1
L nh mhi
X X mhi X
+ fh (1 − fhi ) (yhij − y hi )(xhij − xhi )
i=1
mhi − 1 j=1
h=1
On the basis of the formulas (1) and (2), writing down the variance estimator for a survey design
with three or more stages is a matter of deriving the variance component for each sampling stage.
The sampling units from a given stage pose as strata for the next sampling stage.
All but the last stage must be sampled without replacement to get nonzero variance components
from each stage of clustered sampling. For example, if fh = 0 in (2), the second stage contributes
nothing to the variance estimator.
singleunit(centered) specifies that strata with one sampling unit are centered at the population
mean instead of the stratum mean. The quotient nh /(nh − 1) in the variance formula is also taken
to be 1 if nh = 1.
b= Y
b
R
X
b
and its score variable is
∂Rb yj − Rb xj
zj (R)
b = =
∂wj X
b
Plugging this into (1) or (2) results in a variance estimator that is algebraically equivalent to the
variance estimator derived from directly applying the delta method (a first-order Taylor expansion
with respect to y and x)
b = 1 Vb (Yb ) − 2R b2 Vb (X)
Vb (R) b Cov(
d Yb , X)b +R b
X
b 2
192 variance estimation — Variance estimation for survey data
G(β) = X 0 Y − X 0 X β = 0
where Y is the vector of outcomes for the full population and X is the matrix of explanatory variables
for the full population. For a pseudolikelihood model—such as logistic regression— G(β) is the first
derivative of the log-pseudolikelihood function with respect to β. Estimate β by solving for βb from
the weighted sample estimating equations
m
X
G(
b β) = wj S(β; yj , xj ) = 0 (3)
j=1
The associated estimation command with iweights will produce point estimates β
b equal to the
solution of (3).
A first-order matrix Taylor-series expansion yields
( )−1
b−β ≈ − ∂ G(
b β)
β G(
b β)
∂β
where D is (Xs0 W Xs )−1 for linear regression (where W is a diagonal matrix of the sampling weights
and Xs is the matrix of sampled explanatory variables) or the inverse of the negative Hessian matrix
from the pseudolikelihood model. Write G( b β) as
m
X
G(
b β) = wj dj
j=1
where dj = sj xj and sj is a residual for linear regression or an equation-level score from the
pseudolikelihood model. The term equation-level score means the derivative of the log pseudolikelihood
with respect to xj β. In either case, G(
b βb ) is an estimator for the total G(β), and the variance estimator
V {G(β)}| b is computed using the design-based variance estimator for a total.
b b
β=β
The above result is easily extended to models with ancillary parameters, multiple regression
equations, or both.
The bootstrap
The bootstrap methods for survey data used in recent years are largely due to McCarthy and
Snowden (1985), Rao and Wu (1988), and Rao, Wu, and Yue (1992). For example, Yeo, Mantel,
and Liu (1999) cite Rao, Wu, and Yue (1992) with the method for variance estimation used in the
National Population Health Survey conducted by Statistics Canada.
In the survey bootstrap, the model is fit multiple times, once for each of a set of adjusted sampling
weights that mimic bootstrap resampling. The variance is estimated using the resulting replicated
point estimates.
Let bθ be the vector of point estimates computed using the sampling weights for a given survey
θ could be a vector of means, ratios, or regression coefficients). Each bootstrap
dataset (for example, b
replicate is produced by fitting the model with adjusted sampling weights. The adjusted sampling
weights are derived from the method used to resample the original survey data.
According to Yeo, Mantel, and Liu (1999), if nh is the number of observed PSUs in stratum h,
then nh − 1 PSUs are sampled with replacement from within stratum h. This sampling is performed
independently across the strata to produce one bootstrap sample of the survey data. Let r be the
number of bootstrap samples. Suppose that we are about to generate the adjusted-weight variable for
the ith bootstrap replication and whij is the sampling weight attached to the j th observation in the
ith PSU of stratum h. The adjusted weight is
∗ nh
whij = m∗ whij
nh − 1 hi
where m∗hi is the number of times the ith cluster in stratum h was resampled.
To accommodate privacy concerns, many public-use datasets contain replicate-weight variables
derived from the “mean bootstrap” described by Yung (1997). In the mean bootstrap, each adjusted
weight is derived from b bootstrap samples instead of one. The adjusted weight is
∗ nh
whij = m∗ whij
nh − 1 hi
where
b
1X ∗
m∗hi = mhik
b
k=1
194 variance estimation — Variance estimation for survey data
is the average of the number of times the ith cluster in stratum h was resampled among the b bootstrap
samples.
Each replicate is produced using an adjusted-weight variable with the estimation command that
computed bθ. The adjusted-weight variables must be supplied to svyset with the bsrweight() option.
For the mean bootstrap, b must also be supplied to svyset with the bsn() option; otherwise, bsn(1)
is assumed. We call the variables supplied to the bsrweight() option bootstrap replicate-weight
variables when b = 1 and mean bootstrap replicate-weight variables when b > 1.
θ(i) be the vector of point estimates from the ith replication. When the mse option is specified,
Let b
the variance estimator is
r
b X b
V (θ) =
b b {θ(i) − b
θ}{bθ(i) − bθ}0
r i=1
BRR
BRR was first introduced by McCarthy (1966, 1969a, and 1969b) as a method of variance estimation
for designs with two PSUs in every stratum. The BRR variance estimator tends to give more reasonable
variance estimates for this design than the linearized variance estimator, which can result in large
values and undesirably wide confidence intervals.
The model is fit multiple times, once for each of a balanced set of combinations where one PSU is
dropped (or downweighted) from each stratum. The variance is estimated using the resulting replicated
point estimates (replicates). Although the BRR method has since been generalized to include other
designs, Stata’s implementation of BRR requires two PSUs per stratum.
Let bθ be the vector of point estimates computed using the sampling weights for a given stratified
θ could be a vector of means, ratios, or regression coefficients). Each BRR
survey design (for example, b
replicate is produced by dropping (or downweighting) a PSU from every stratum. This could result
in as many as 2L replicates for a dataset with L strata; however, the BRR method uses Hadamard
matrices to identify a balanced subset of the combinations from which to produce the replicates.
A Hadamard matrix is a square matrix, Hr (with r rows and columns), such that Hr0 Hr = rI ,
where I is the identity matrix. The elements of Hr are +1 and −1; −1 causes the first PSU to be
downweighted and +1 causes the second PSU to be downweighted. Thus r must be greater than or
equal to the number of strata.
Suppose that we are about to generate the adjusted-weight variable for the ith replication and wj
is the sampling weight attached to the j th observation, which happens to be in the first PSU of stratum
h. The adjusted weight is
(
∗
f wj , if Hr [i, h] = −1
wj =
(2 − f )wj , if Hr [i, h] = +1
where f is Fay’s adjustment (Judkins 1990). By default, f = 0.
variance estimation — Variance estimation for survey data 195
Each replicate is produced using an adjusted-weight variable with the estimation command that
computed b θ. The adjusted-weight variables can be generated by Stata or supplied to svyset with the
brrweight() option. We call the variables supplied to the brrweight() option BRR replicate-weight
variables.
θ(i) be the vector of point estimates from the ith replication. When the mse option is specified,
Let b
the variance estimator is
r
1 X
Vb (b
θ) = {b
θ(i) − b
θ}{b θ}0
θ(i) − b
r(1 − f )2 i=1
The jackknife
The jackknife method for variance estimation is appropriate for many models and survey designs.
The model is fit multiple times, and each time one or more PSUs are dropped from the estimation
sample. The variance is estimated using the resulting replicates (replicated point estimates).
θ be the vector of point estimates computed using the sampling weights for a given survey
Let b
θ could be a vector of means, ratios, or regression coefficients). The dataset
design (for example, b
is resampled by dropping one or more PSUs from one stratum and adjusting the sampling weights
θ.
before recomputing a replicate for b
Let whij be the sampling weight for the j th individual from PSU i in stratum h. Suppose that
you are about to generate the adjusted weights for the replicate resulting from dropping k PSUs from
stratum h. The adjusted weight is
0, if a = h and b is dropped
∗
nh
wabj = wabj , if a = h and b is not dropped
nh − k
wabj , otherwise
Each replicate is produced by using the adjusted-weight variable with the estimation command
that produced bθ. For the delete-one jackknife (where one PSU is dropped for each replicate), adjusted
weights can be generated by Stata or supplied to svyset with the jkrweight() option. For the delete-
k jackknife (where k > 1 PSUs are dropped for each replicate), the adjusted-weight variables must
be supplied to svyset using the jkrweight() option. The variables supplied to the jkrweight()
option are called jackknife replicate-weight variables.
196 variance estimation — Variance estimation for survey data
r
4 X
θ) = (1 − f )
Vb (b {b
θ(i) − b
θ}{b θ}0
θ(i) − b
r i=1
Confidence intervals
In survey data analysis, the customary number of degrees of freedom attributed to a test statistic is
d = n − L, where n is the number of PSUs and L is the number of strata. Under regularity conditions,
an approximate 100(1 − α)% confidence interval for a parameter θ (for example, θ could be a total,
ratio, or regression coefficient) is
b 1/2
θb ± t1−α/2,d {Vb (θ)}
Cochran (1977, sec. 2.8) and Korn and Graubard (1990) give some theoretical justification for
using d = n − L to compute univariate confidence intervals and p-values. However, for some cases,
inferences based on the customary n − L degrees-of-freedom calculation may be excessively liberal;
the resulting confidence intervals may have coverage rates substantially less than the nominal 1 − α.
This problem generally is of the greatest practical concern when the population of interest has a
skewed or heavy-tailed distribution or is concentrated in a few PSUs. In some of these cases, the user
may want to consider constructing confidence intervals based on alternative degrees-of-freedom terms,
based on the Satterthwaite (1941, 1946) approximation and modifications thereof; see, for example,
Cochran (1977, sec. 5.4) and Eltinge and Jang (1996).
Sometimes there is no information on n or L for datasets that contain replicate-weight variables
but no PSU or strata variables. Each of svy’s replication commands has its own default behavior
when the design degrees of freedom are not svyset or specified using the dof() option. svy brr:
and svy jackknife: use d = r − 1, where r is the number of replications. svy bootstrap: and
svy sdr: use z1−α/2 for the critical value instead of t1−α/2,d .
References
Binder, D. A. 1983. On the variances of asymptotically normal estimators from complex surveys. International
Statistical Review 51: 279–292.
Cochran, W. G. 1977. Sampling Techniques. 3rd ed. New York: Wiley.
Demnati, A., and J. N. K. Rao. 2004. Linearization variance estimators for survey data. Survey Methodology 30:
17–26.
Deville, J.-C. 1999. Variance estimation for complex statistics and estimators: Linearization and residual techniques.
Survey Methodology 25: 193–203.
Eltinge, J. L., and D. S. Jang. 1996. Stability measures for variance component estimators under a stratified multistage
design. Survey Methodology 22: 157–165.
variance estimation — Variance estimation for survey data 199
Fay, R. E., and G. F. Train. 1995. Aspects of survey and model-based postcensal estimation of income and poverty
characteristics for states and counties. In Proceedings of the Government Statistics Section, 154–159. American
Statistical Association.
Fuller, W. A. 1975. Regression analysis for sample survey. Sankhyā, Series C 37: 117–132.
Godambe, V. P., ed. 1991. Estimating Functions. Oxford: Oxford University Press.
Judkins, D. R. 1990. Fay’s method for variance estimation. Journal of Official Statistics 6: 223–239.
Kish, L., and M. R. Frankel. 1974. Inference from complex samples. Journal of the Royal Statistical Society, Series
B 36: 1–37.
Kolenikov, S. 2010. Resampling variance estimation for complex survey data. Stata Journal 10: 165–199.
Korn, E. L., and B. I. Graubard. 1990. Simultaneous testing of regression coefficients with complex survey data: Use
of Bonferroni t statistics. American Statistician 44: 270–276.
McCarthy, P. J. 1966. Replication: An approach to the analysis of data from complex surveys. In Vital and Health
Statistics, series 2. Hyattsville, MD: National Center for Health Statistics.
. 1969a. Pseudoreplication: Further evaluation and application of the balanced half-sample technique. In Vital
and Health Statistics, series 2. Hyattsville, MD: National Center for Health Statistics.
. 1969b. Pseudo-replication: Half-samples. Revue de l’Institut International de Statistique 37: 239–264.
McCarthy, P. J., and C. B. Snowden. 1985. The bootstrap and finite population sampling. In Vital and Health Statistics,
1–23. Washington, DC: U.S. Government Printing Office.
Rao, J. N. K., and C. F. J. Wu. 1988. Resampling inference with complex survey data. Journal of the American
Statistical Association 83: 231–241.
Rao, J. N. K., C. F. J. Wu, and K. Yue. 1992. Some recent work on resampling methods for complex surveys. Survey
Methodology 18: 209–217.
Särndal, C.-E., B. Swensson, and J. Wretman. 1992. Model Assisted Survey Sampling. New York: Springer.
Satterthwaite, F. E. 1941. Synthesis of variance. Psychometrika 6: 309–316.
. 1946. An approximate distribution of estimates of variance components. Biometrics Bulletin 2: 110–114.
Shah, B. V. 2004. Comment [on Demnati and Rao (2004)]. Survey Methodology 30: 29.
Shao, J., and D. Tu. 1995. The Jackknife and Bootstrap. New York: Springer.
Skinner, C. J. 1989. Introduction to part A. In Analysis of Complex Surveys, ed. C. J. Skinner, D. Holt, and
T. M. F. Smith, 23–58. New York: Wiley.
Wolter, K. M. 2007. Introduction to Variance Estimation. 2nd ed. New York: Springer.
Yeo, D., H. Mantel, and T.-P. Liu. 1999. Bootstrap variance estimation for the National Population Health Survey.
In Proceedings of the Survey Research Methods Section, 778–785. American Statistical Association.
Yung, W. 1997. Variance estimation for public use files under confidentiality constraints. In Proceedings of the Survey
Research Methods Section, 434–439. American Statistical Association.
Also see
[SVY] svy — The survey prefix command
[SVY] svyset — Declare survey design for dataset
[SVY] survey — Introduction to survey commands
[P] robust — Robust variance estimates
Glossary
201
202 Glossary
where Ir is the identity matrix of order r. Generating a Hadamard matrix with order r = 2p
is easily accomplished. Start with a Hadamard matrix of order 2 (H2 ), and build your Hr by
repeatedly applying Kronecker products with H2 .
jackknife. The jackknife is a data-dependent way to estimate the variance of a statistic, such as a
mean, ratio, or regression coefficient. Unlike BRR, the jackknife can be applied to practically any
survey design. The jackknife variance estimator is described in [SVY] variance estimation.
linearization. Linearization is short for Taylor linearization. Also known as the delta method or
the Huber/White/robust sandwich variance estimator, linearization is a method for deriving an
approximation to the variance of a point estimator, such as a ratio or regression coefficient. The
linearized variance estimator is described in [SVY] variance estimation.
MEFF and MEFT. MEFF and MEFT are misspecification effects. Misspecification effects compare
the variance estimate from a given survey dataset with the variance from a misspecified model. In
Stata, the misspecified model is fit without weighting, clustering, or stratification.
MEFF is the ratio of two variance estimates. The design-based variance is in the numerator; the
misspecified variance is in the denominator.
MEFT is the ratio of two standard-error estimates. The design-based standard error is in the
numerator; the misspecified standard error is in the denominator. MEFT is the square root of MEFF.
misspecification effects. See MEFF and MEFT.
point estimate. A point estimate is another name for a statistic, such as a mean or regression
coefficient.
poststratification. Poststratification is a method for adjusting sampling weights, usually to account
for underrepresented groups in the population. This usually results in decreased bias because of
nonresponse and underrepresented groups in the population. Poststratification also tends to result
in smaller variance estimates.
The population is partitioned into categories, called poststrata. The sampling weights are adjusted
so that the sum of the weights within each poststratum is equal to the respective poststratum size.
The poststratum size is the number of individuals in the population that are in the poststratum.
The frequency distribution of the poststrata typically comes from census data, and the poststrata
are most commonly identified by demographic information such as age, sex, and ethnicity.
predictive margins. Predictive margins provide a way of exploring the response surface of a fitted
model in any response metric of interest—means, linear predictions, probabilities, marginal effects,
risk differences, and so on. Predictive margins are estimates of responses (or outcomes) for
the groups represented by the levels of a factor variable, controlling for the differing covariate
distributions across the groups. They are the survey-data and nonlinear response analogue to what
are often called estimated marginal means or least-squares means for linear models.
Because these margins are population-weighted averages over the estimation sample or subsamples,
and because they take account of the sampling distribution of the covariates, they can be used to
make inferences about treatment effects for the population.
primary sampling unit. Primary sampling unit (PSU) is a cluster that was sampled in the first sampling
stage; see cluster.
probability weight. Probability weight is another term for sampling weight.
pseudolikelihood. A pseudolikelihood is a weighted likelihood that is used for point estimation.
Pseudolikelihoods are not true likelihoods because they do not represent the distribution function
for the sample data from a survey. The sampling distribution is instead determined by the survey
design.
Glossary 203
population. This approach results in a different variance than measuring the sample-to-sample vari-
ability by restricting the samples to individuals within the subpopulation; see [SVY] subpopulation
estimation.
successive difference replication. Successive difference replication (SDR) is a method of variance
typically applied to systematic samples, where the observed sampling units are somehow ordered.
The SDR variance estimator is described in [SVY] variance estimation.
survey data. Survey data consist of information about individuals that were sampled from a population
according to a survey design. Survey data distinguishes itself from other forms of data by the
complex nature under which individuals are selected from the population.
In survey data analysis, the sample is used to draw inferences about the population. Furthermore,
the variance estimates measure the sample-to-sample variability that results from the survey design
applied to the fixed population. This approach differs from standard statistical analysis, in which the
sample is used to draw inferences about a physical process and the variance measures the sample-
to-sample variability that results from independently collecting the same number of observations
from the same process.
survey design. A survey design describes how to sample individuals from the population. Survey
designs typically include stratification and cluster sampling at one or more stages.
Taylor linearization. See linearization.
variance estimation. Variance estimation refers to the collection of methods used to measure the
amount of sample-to-sample variation of point estimates; see [SVY] variance estimation.
Subject and author index
See the combined subject index and the combined author index in the Glossary and Index.
205