To do each example, just click the "Submit" button. You do not have to type in any R instructions or specify a dataset. That's already done for you.
for
loop should
be familiar, just like what we did calculating bootstrap standard errors
(sd(theta.star)
would be the bootstrap standard error).
quantile
calculates quantiles of a data
vector, at least, what it calls quantiles. Its definition is a bit eccentric,
but is asymptotically equivalent to all other definitions of quantiles.
conf.level
by
conf.level <- 0.90
An alternative method for quantiles preferred by your humble instructor uses the following logic.
Use nboot <- 999
(or some other
value such that nboot + 1
is a round number. The reason is
that if X(i) is the i-th order
statistic from a Uniform(0, 1) distribution
Another way to think of this is that the nboot
data points
divide the number line into nboot + 1
intervals, which as
far as we know contain equal probability. They don't contain equal
probability because the sample is not the population, but we might as well
treat them as such for the purposes of estimation. That is,
our nboot
data points should be taken as estimators of the
quantiles with denominators nboot + 1
In particular, if nboot
is 999, then we take
the ordered theta.star
values to be the 0.001, 0.002, . . .,
0.999 quantiles of the sampling distribution of theta.hat
.
Thus