# Rao Blackwell theorem on Bernoulli distribution

I need help with the following Problem: Let $$X_1,...,X_n$$ be a random sample of iid random variables, $$X_i\sim Ber(p), p\in (0,1)$$. We want to estimate $$\theta = p^2$$. It is known, that $$\hat{\theta}(X_1,...,X_n)=\sum \limits_{i=1}^{n} X_i$$ is complete and sufficient. Futhermore, it is easy to see, that the estimator $$\tilde{\theta}=X_1X_2$$ is unbiased.
We have to use the Rao-Blackwell theorem to find a better estimator $$\theta^*=E[\tilde{\theta}|\hat{\theta}]$$.
I would like where the mistake in the following idea is:
First, we obeserve that $$\tilde{\theta}=X_1X_2\in\left\{0,1\right\}$$ almost surely and $$\tilde{\theta}=1 \Leftrightarrow X_1=X_2=1$$ . Then
$$\theta^*=E[\tilde{\theta}|\hat{\theta}] = E[\tilde{\theta}|\hat{\theta}=k]=1\cdot P(\tilde{\theta}=1|\hat{\theta}=k)+0\cdot P(\tilde{\theta}=0|\hat{\theta}=k)=P(X_1=1,X_2=1|\sum \limits_{i=1}^{n} X_i=k) \\ =\frac{P(X_1=1,X_2=1,\sum \limits_{i=3}^{n} X_i=k-2)}{P(\sum \limits_{i=1}^{n} X_i=k)}=\frac{P(X_1=1)P(X_2=1)P(\sum \limits_{i=3}^{n} X_i=k-2)}{P(\sum \limits_{i=1}^{n} X_i=k)}=\frac{P(X_1=1)P(X_2=1)P(\sum \limits_{l=1}^{n-2} X_l=k-2)}{P(\sum \limits_{i=1}^{n} X_i=k)}=p^2\frac{\binom{n-2}{k-2}p^{k-2}(1-p)^{n-2-k+2}}{\binom{n}{k}p^k(1-p)^{n-k}}\\ =\frac{\binom{n-2}{k-2}}{\binom{n}{k}}=\frac{(n-2)!k!}{n!(k-2)!}=\frac{k(k-1)}{n(n-1)}$$ I know there has to be a mistake somewhere since $$\theta^*=E[\tilde{\theta}|\hat{\theta}]$$ is not unbiased, but it should be.

• Is the goal to find an estimator that uses the entire sample of size $n$ rather than an estimator using a subsample of size 2? Nov 13, 2021 at 19:34

The computation is fine. I think the problem is conceptual. $$\theta^*=E[\tilde{\theta}|\hat{\theta}]$$ is a random variable which is a function of $$\hat{\theta}$$, whose value when $$\hat{\theta}=k$$ is $$E[\tilde{\theta}|\hat{\theta}=k] = \frac{k(k-1)}{n(n-1)}$$. Hence, to compute the expectation you should remember the formula $$E[g(X)]=\sum_k g(k) P(X=k)$$. Here $$\hat{\theta}$$ plays the role of $$X$$ and $$g(k)=E[\tilde{\theta}|\hat{\theta}=k]$$. Therefore: $$E[\theta^*]=\sum_{k=2}^n E[\tilde{\theta}|\hat{\theta}=k] P(\hat{\theta}=k)= \sum_{k=2}^n \frac{\binom{n-2}{k-2}}{\binom{n}{k}} \binom{n}{k}p^k(1-p)^{n-k} = p^2\sum_{k=2}^n \binom{n-2}{k-2} p^{k-2}(1-p)^{n-2-(k-2)} = p^2,$$ as one would expect, since by the law of iterated expected values: $$E[\theta^*]=E[E[\tilde{\theta}|\hat{\theta}]]=E[\tilde{\theta}]=p^2$$.