-------------------------------------------------------------------------------
log: /Users/baum/Desktop/771bs1.smcl
log type: smcl
opened on: 18 Jan 2004, 13:01:37
. set more off
. set seed 123456789
. local reps 1000
.
. webuse census2, clear
(1980 Census data by state)
. summ age
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
age | 50 29.5 1.752549 24 35
. ci age
Variable | Obs Mean Std. Err. [95% Conf. Interval]
-------------+---------------------------------------------------------------
age | 50 29.5 .2478479 29.00193 29.99807
. bootstrap "summ age" r(mean) r(sd), reps(`reps') saving(771bs1) replace
command: summ age
statistics: _bs_1 = r(mean)
_bs_2 = r(sd)
Warning: Since summ is not an estimation command or does not set e(sample),
bootstrap has no way to determine which observations are used in
calculating the statistics and so assumes that all observations are
used. This means no observations will be excluded from the
resampling due to missing values or other reasons.
If the assumption is not true, press Break, save the data, and drop
the observations that are to be excluded. Be sure the dataset in
memory contains only the relevant data.
Bootstrap statistics Number of obs = 50
Replications = 1000
------------------------------------------------------------------------------
Variable | Reps Observed Bias Std. Err. [95% Conf. Interval]
-------------+----------------------------------------------------------------
_bs_1 | 1000 29.5 .00334 .2374498 29.03404 29.96596 (N)
| 29.04 29.99 (P)
| 29.06 30 (BC)
_bs_2 | 1000 1.752549 -.0224573 .2554975 1.251176 2.253923 (N)
| 1.228065 2.217784 (P)
| 1.277913 2.260937 (BC)
------------------------------------------------------------------------------
Note: N = normal
P = percentile
BC = bias-corrected
.
. use 771bs1,clear
(bootstrap: summ age)
. graph drop _all
. histogram _bs_1, normal name(g771bs1_m)
(bin=29, start=28.780001, width=.04896552)
. histogram _bs_2, normal name(g771bs1_s)
(bin=29, start=1.0879676, width=.05032897)
. graph combine g771bs1_m g771bs1_s, col(1) ///
> ti("Bootstrap distributions of mean and standard error")
. graph save 771bs.pdf, replace
(file 771bs.pdf saved)
.
. log close
log: /Users/baum/Desktop/771bs1.smcl
log type: smcl
closed on: 18 Jan 2004, 13:01:52
-------------------------------------------------------------------------------