**[SVY] svy bootstrap** -- Bootstrap for survey data

__Syntax__

**svy** **bootstrap** *exp_list* [**,** *svy_options* *bootstrap_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**.

*svy_options* Description
-------------------------------------------------------------------------
if/in
__sub__**pop(**[*varname*] [*if*]**)** identify a subpopulation

Reporting
__l__**evel(***#***)** set confidence level; default is **level(95)**
__noh__**eader** suppress table header
__nol__**egend** suppress table legend
__noadj__**ust** do not adjust model Wald statistic
__nocnsr__**eport** 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

__coefl__**egend** display legend instead of statistics
-------------------------------------------------------------------------
**coeflegend** is not shown in the dialog boxes for estimation commands.

*bootstrap_options* Description
-------------------------------------------------------------------------
Main
**bsn(***#***)** bootstrap mean-weight adjustment

Options
__sa__**ving(***filename*[**,** ...]**)** save results to *filename*; save statistics in
double precision; save results to *filename*
every *#* replications
**mse** use MSE formula for variance

Reporting
__v__**erbose** display the full table legend
**nodots** suppress replication dots
**dots(***#***)** display dots every *#* replications
__noi__**sily** display any output from *command*
__tr__**ace** trace *command*
__ti__**tle(***text***)** use *text* as title for bootstrap results

Advanced
**nodrop** do not drop observations
**reject(***exp***)** identify invalid results
**dof(***#***)** design degrees of freedom
-------------------------------------------------------------------------
**svy** requires that the survey design variables be identified using **svyset**.
*command* defines the estimation command to be executed. The **by** prefix
cannot be part of *command*.
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.
**svy** **bootstrap** requires that the bootstrap replicate weights be identified
using **svyset**.

__Menu__

**Statistics > Survey data analysis > Resampling > Bootstrap estimation**

__Description__

**svy** **bootstrap** performs nonparametric bootstrap estimation of specified
statistics (or expressions) for a Stata command or a user-written
program. 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 programs that meet the requirements in **[P]**
**program properties** may also be used.

__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**.

+---------+
----+ Options +----------------------------------------------------------

**saving(***filename* [**,** *suboptions*]**)** creates a Stata data file (**.dta** file)
consisting of (for each statistic in *exp_list*) a variable containing
the replicates.

See *prefix_saving_option* for details about *suboptions*.

**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.

+-----------+
----+ 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.

**dots(***#***)** displays dots every *#* replications. **dots(0)** is a synonym for
**nodots**.

**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 = N_psu - N_strata.

__Examples__

**. webuse nmihs_bs**
**. svyset**
**. svy, nodots: mean birthwgt**

**. webuse nmihs_mbs**
**. svyset**
**. svy, nodots: mean birthwgt**

__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*.