set.seed(2021)
# non-parametric bootstrap, re-sample from sample
a.obs = mean(x); a.obs
[1] 17.584
d.re = replicate(3000, mean(sample(x, 50, rep=T))-a.obs)
UL = quantile(d.re,c(.975,.025))
a.obs - UL
97.5% 2.5%
9.12105 23.81885
For my fictitious data x
the resulting 95% parametric
bootstrap CI is $(12.44, 22.13).$ This interval is narrower
than the nonparametric bootstrap CI because it is based
on the additional information that the population is exponential. [I did more re-samples here because
parametric bootstrap CIs with larger numbers of resamples
may be noticablynoticeably more accurate.]
set.seed(2021)
# parametric bootstrap, sample 50 from EXP(rate=1/a.obs)
a.obs = mean(x); a.obs
[1] 17.584
d.re = replicate(10000, mean(rexp(50,1/obs.a.obs))-a.obs)
UL = quantile(d.re,c(.975,.025))
a.obs - UL
97.5% 2.5%
12.44381 22.13479
set.seed(2021)
# parametric bootstrap of ratios, sample 50 from EXP(rate=1/a.obs)
r.re = replicate(3000, mean(rexp(50,1/obs.a))/a.obs)
UL = quantile(r.re,c(.975,.025))
a.obs / UL
97.5% 2.5%
13.66134 23.76732