**[SVY] svy brr** -- Balanced repeated replication for survey data

__Syntax__

[**svy**] **brr** *exp_list* [**,** *svy_options* *brr_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.

*brr_options* Description
-------------------------------------------------------------------------
Main
__h__**adamard(***matrix***)** Hadamard matrix
**fay(***#***)** Fay's 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 BRR 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.

__Menu__

**Statistics > Survey data analysis > Resampling >** **Balanced repeated**
**replications estimation**

__Description__

**svy** **brr** performs balanced repeated replication (BRR) 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 BRR
methodology. Any Stata estimation command listed in **[SVY] svy estimation**
may be used with **svy** **brr**. User-written programs that meet the
requirements in **[P] program properties** may also be used.

__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, where 0 __<__ *#* __<__ 2, but excluding 1.
This option overrides the **fay(***#***)** 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** **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.

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

__Examples__

**. webuse nhanes2brr**
**. svyset**
**. svy brr WtoH = (_b[weight]/_b[height]) : total weight height**
**. svy brr WtoH = (_b[weight]/_b[height]), mse : total weight height**

Hadamard matrices

**. matrix h2 = (-1, 1 \ 1, 1)**
**. matrix h4 = h2 # h2**
**. matrix h8 = h2 # h4**
**. matrix h16 = h2 # h8**
**. matrix h32 = h2 # h16**
**. webuse nhanes2**
**. svy brr, hadamard(h32) : ratio (WtoH: weight/height)**

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