Stata 11 help for bsample

help bsample dialog: bsample -------------------------------------------------------------------------------

Title

[R] bsample -- Sampling with replacement

Syntax

bsample [exp] [if] [in] [, options]

where exp is a standard Stata expression; see exp.

options description ------------------------------------------------------------------------- strata(varlist) variables identifying strata cluster(varlist) variables identifying resampling clusters idcluster(newvar) create new cluster ID variable weight(varname) replace varname with frequency weights -------------------------------------------------------------------------

Menu

Statistics > Resampling > Draw bootstrap sample

Description

bsample draws random samples with replacement from the data in memory.

exp specifies the size of the sample, which must be less than or equal to the number of sampling units in the data. The observed number of units is the default when exp is not specified.

For a simple random sample (SRS) of the observations, exp must be less than or equal to _N (the number of observations in the data; see _N).

For stratified SRS, exp must be less than or equal to _N within the strata identified by the strata() option.

For clustered sampling, exp must be less than or equal to N_c (the number of clusters identified by the cluster() option).

For stratified sampling of clusters, exp must be less than or equal to N_c within the strata identified by the strata() option.

Observations that do not meet the optional if and in criteria are dropped (not sampled).

Options

strata(varlist) specifies the variables identifying strata. If strata() is specified, bootstrap samples are selected within each stratum.

cluster(varlist) specifies the variables identifying resampling clusters. If cluster() is specified, the sample drawn during each replication is a bootstrap sample of clusters.

idcluster(newvar) creates a new variable containing a unique identifier for each resampled cluster.

weight(varname) specifies a variable in which the sampling frequencies will be placed. varname must be an existing variable, which will be replaced. After bsample, varname can be used as an fweight in any Stata command that accepts fweights, which can speed up resampling for commands like regress and summarize. This option cannot be combined with idcluster().

By default, bsample replaces the data in memory with the sampled observations; however, specifying the weight() option causes only the specified varname to be changed.

Examples

--------------------------------------------------------------------------- . webuse bsample1 . bsample 200 --------------------------------------------------------------------------- . webuse bsample1, clear . bsample 200, strata(female) --------------------------------------------------------------------------- . webuse bsample1, clear . bsample 200 if female ---------------------------------------------------------------------------

Also see

Manual: [R] bsample

Help: [R] bootstrap, [R] bstat, [R] simulate, [D] sample


© Copyright 1996–2009 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index