Solution (source code)

= Solution

The nonparametric <bootstrap> replaces the unknown sampling law by the <empirical distribution>
$$
\widehat F_n(x)=\frac1n\sum_{i=1}^n\mathbf1_{\{x_i\le x\}}.
$$
Generate $B$ independent <bootstrap samples>, each containing $n$ independent draws with replacement from that law. Recompute the original estimator in each sample, obtaining $\widehat\theta_1^*,\ldots,\widehat\theta_B^*$. With $\overline\theta^*=B^{-1}\sum_b\widehat\theta_b^*$, the <bootstrap standard error> estimate is
$$
\boxed{\widehat{\operatorname{se}}_*(\widehat\theta)
=\left[\frac1{B-1}\sum_{b=1}^B(\widehat\theta_b^*-\overline\theta^*)^2\right]^{1/2}.}
$$
This estimates the conditional <bootstrap> standard deviation, which approximates the estimator's sampling standard deviation when the <bootstrap> is consistent. Dividing this expression by $\sqrt B$ would instead estimate the Monte Carlo error in the <bootstrap> mean, a different quantity.

For distinct original observations, each resample is an ordered index sequence with one of $n^n$ equally likely values. It contains no repeats precisely when it is a permutation of all $n$ original indices, giving $n!$ possibilities. Hence
$$
\boxed{\mathbb P_*(\text{at least one repeated observation})=1-\frac{n!}{n^n}.}
$$
The distinctness assumption is needed to equate repeated values with repeated indices.