help svy also see: svy estimation
svy postestimation
-------------------------------------------------------------------------------
Title
[SVY] svy -- The survey prefix command
Syntax
svy [vcetype] [, svy_options eform_option] : command
vcetype description
-------------------------------------------------------------------------
SE
linearized Taylor-linearized variance estimation
brr BRR variance estimation; see [SVY] svy brr
jackknife jackknife variance estimation; see [SVY] svy
jackknife
-------------------------------------------------------------------------
Specifying a vcetype overrides the default from svyset.
svy_options description
-------------------------------------------------------------------------
if/in
subpop([varname] [if]) identify a subpopulation
SE
brr_options more options allowed with BRR variance
estimation
jackknife_options more options allowed with jackknife variance
estimation
Reporting
level(#) set confidence level; default is level(95)
nocnsreport do not display constraints
display_options control spacing and display of omitted variables
and base and empty cells
+ noheader suppress table header
+ nolegend suppress table legend
+ noadjust do not adjust model Wald statistic
+ noisily display any output from command
+ trace trace command
+ coeflegend display coefficients' legend instead of
coefficient table
-------------------------------------------------------------------------
+ noheader, nolegend, noadjust, noisily, trace, and coeflegend are not
shown in the dialog boxes for estimation commands.
svy requires that the survey design variables be identified using svyset.
mi estimate may be used with svy linearized if the estimation command
allows mi estimate; it may not be used with svy brr or svy jackknife.
See [SVY] svy postestimation for features available after estimation.
Warning: Using if or in restrictions will often not produce correct
variance estimates for subpopulations. To compute estimates for
subpopulations, use the subpop() option.
Description
svy fits statistical models for complex survey data. Typing
. svy: command
executes command while accounting for the survey settings identified by
svyset.
command defines the estimation command to be executed. Not all
estimation commands are supported by svy. See [SVY] svy estimation for a
list of Stata's estimation commands that are supported by svy. See [P]
program properties for a discussion of what is required for svy to
support an estimation command. The by prefix may not be part of command.
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!=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.
+----+
----+ SE +---------------------------------------------------------------
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.
+-----------+
----+ Reporting +--------------------------------------------------------
level(#) specifies the confidence level, as a percentage, for confidence
intervals. The default is level(95) or as set by set level.
nocnsreport; see [R] estimation options.
display_options: noomitted, vsquish, noemptycells, baselevels,
allbaselevels; 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.
nolegend prevents the table legend identifying the subpopulations from
being displayed.
noadjust specifies that the model Wald test be carried out as W/k
distributed 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) distributed 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.
Examples
. webuse nhanes2f
. svyset psuid [pweight=finalwgt], strata(stratid)
. svy: mean zinc
. mean zinc
. svyset [pweight=finalwgt]
. svy: mean zinc
. svyset psuid [pweight=finalwgt]
. svy: mean zinc
. svyset psuid [pweight=finalwgt], strata(stratid)
. svy: regress zinc age age2 weight female black orace rural
Saved results
svy saves 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) indicates singleton strata
e(census) indicates census data
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(k_eq) number of equations
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(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
Matrices
e(b) estimates
e(V) design-based variance
e(V_srs) simple-random-sampling-without-replacement
variance, V_srswor hat
e(V_srssub) subpopulation
simple-random-sampling-without-replacement
variance, V_srswor hat (created only when
subpop() is specified)
e(V_srswr) simple-random-sampling-with-replacement variance,
V_srswr hat (created only when fpc() option is
svyset)
e(V_srssubwr) subpopulation
simple-random-sampling-with-replacement
variance, V_srswr hat (created only when
subpop() is specified)
e(V_modelbased) model-based variance
e(V_msp) variance from misspecified model fit, V_msp hat
e(_N_strata_single) number of strata with one sampling unit
e(_N_strata_certain) number of certainty strata
e(_N_strata) number of strata
Functions
e(sample) marks estimation sample
svy also carries forward most of the results already in e() from command.
Reference
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.
Also see
Manual: [SVY] svy
Help: [SVY] svy estimation, [SVY] svy postestimation;
[P] program properties, [P] _robust, [SVY] svy brr, [SVY] svy
jackknife, [SVY] svyset