Solution (source code)

= Solution

The <Rao-Blackwell theorem> states that if an estimator $D$ has finite second moment and $T$ is a <sufficient statistic>, then $D^*(T)=\mathbb E[D\mid T]$ can be chosen without knowing the parameter. It has the same expectation as $D$ and no larger <variance>. In particular an <unbiased estimator> remains unbiased and its squared-error risk cannot increase. Sufficiency makes the <conditional distribution>, hence the function of $T$ used here, parameter-independent.

The tower property gives $\mathbb E D^*=\mathbb E D$. The <law of total variance> gives
$$
\operatorname{Var}(D)=\operatorname{Var}(\mathbb E[D\mid T])+\mathbb E[\operatorname{Var}(D\mid T)],
$$
so the <variance> decreases, with equality exactly when $D$ is already a function of $T$ almost surely. Since the bias is unchanged, the same identity proves the squared-error risk claim. More generally the corresponding convex-loss inequality follows from conditional <Jensen's inequality>.

For the given <geometric distribution>, the joint mass is $(1-p)^np^{\sum x_j-n}$ on positive-integer sample vectors. Thus $T=\sum_jX_j$ is a one-dimensional <sufficient statistic>. Directly, conditional on $T=t$, every positive-integer composition of $t$ into $n$ parts has the same <probability>; there are $\binom{t-1}{n-1}$ such compositions, independently of $p$.

The simple estimator $D=1_{\{X_1>1\}}$ is unbiased for $p$, since $\Pr(X_1>1)=p$. For $n\geq2$, compositions with $X_1>1$ are counted by subtracting one from their first part, giving $\binom{t-2}{n-1}$ when $t>n$. Consequently the <Rao-Blackwell estimator of a geometric failure probability> is
$$
\boxed{\widehat p=\mathbb E[D\mid T]=\frac{T-n}{T-1},\qquad n\geq2.}
$$
At $T=n$ its value is zero, as it must be when all observations are one. For the possible one-observation case, use $\widehat p=1_{\{T>1\}}$; the displayed fraction would otherwise be undefined at $T=1$. The conditional-expectation argument proves unbiasedness without needing to sum the negative-binomial mass explicitly.