⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bsample.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 20jan2005}{...}
{cmd:help bsample}{right:dialog:  {bf:{dialog bsample}}}
{hline}

{title:Title}

{p2colset 5 20 22 2}{...}
{p2col :{hi:[R] bsample} {hline 2}}Sampling with replacement{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 16 2}
{cmd:bsample}
	[{it:{help exp}}]
	{ifin}
	[{cmd:,} {it:options}]

{phang}
where {it:exp} is a standard Stata expression; see {help exp}.

{synoptset 21 tabbed}{...}
{synopthdr}
{synoptline}
{syntab :Main}
{synopt :{opth str:ata(varlist)}}variables identifying strata{p_end}
{synopt :{opth cl:uster(varlist)}}variables identifying resampling clusters{p_end}
{synopt :{opth id:cluster(newvar)}}create new cluster ID variable{p_end}
{synopt :{opth w:eight(varname)}}replace {it:varname} with frequency weights{p_end}
{synoptline}
{p2colreset}{...}


{title:Description}

{pstd}
{cmd:bsample} draws random samples with replacement from the data in memory.

{pstd}
{it: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 {it:exp} is not specified.

{phang2}
For a simple random sample (SRS) of the observations, {it:exp} must be less
than or equal to {cmd:_N} (the number of observations in the data; see 
{help _N}).

{phang2}
For stratified SRS, {it:exp} must be less than or equal to {cmd:_N} within
the strata identified by the {opt strata()} option.

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

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

{pstd}
Observations that do not meet the optional {it:{help if}} and {it:{help in}}
criteria are dropped (not sampled).


{title:Options}

{dlgtab:Main}

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

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

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

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

{pmore}
By default, {cmd:bsample} replaces the data in memory with the sampled
observations; however, specifying the {opt weight()} option causes only the
specified {it:varname} to be changed.


{title:Examples}

{phang}{cmd:. bsample 200}{p_end}

{phang}{cmd:. bsample 200, strata(female)}{p_end}

{phang}{cmd:. bsample 200 if female}{p_end}


{title:Also see}

{psee}
Manual:  {bf:[R] bsample}

{psee}
Online:  {helpb bootstrap}, {helpb bstat}, {helpb simulate}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -