# How to get an unbiased estimator

Defining the sample mean as $\bar{x} = \frac{1}{N}\sum_{n=0}^{N-1}x_n$, and having $N$ realizations of a random variable $x$ with mean $\mu$ and variance $\sigma^2$
Defining $\bar{x}^2=\hat{\mu^2}$, I get that $Bias(\bar{x}^2) = E[\bar{x}^2] - \mu^2=E[\bar{x}]^2+Var(\bar{x}) - \mu^2 = \mu^2+ \frac{\sigma^2}{N} - \mu^2 = \frac{\sigma^2}{N}$ is a biased estimator.
Would it be possible to obtain an unbiased estimator of $\mu^2$?
Any help is appreciated!

• Please define $Bias(\bar{x}^2)$ and consider adding the self-study tag. Nov 5 '17 at 18:18
• Why are you omitting the last observation in your definition of the sample mean? If you're trying to use Bessel's correction, that requires changing the divisor, not removing an observation, and it can only do you any good when estimating a variance, not a mean. Nov 5 '17 at 18:52
• An alternative view to unbiasedness is presented in this Gelman blog post ... andrewgelman.com/2015/06/10/… Nov 5 '17 at 19:51

Suppose $X_1, \dots, X_N \sim (\mu, \sigma^2)$. Then observe that $$\mu^2 = \mu_2 + \sigma^2$$ where I am using $\mu_2$ to represent the second moment $\mathbb{E}[X^2]$.
Then, a well-known unbiased estimator of $\sigma^2$ is $$S^2 = \dfrac{1}{N-1}\sum_{i=1}^{N}(X_i-\bar{X})^2$$ where $\bar{X} = \dfrac{\sum_{i=1}^{N}X_i}{N}$.
Furthermore, in general, if we have a function $g$ such that $\mathbb{E}[g(X_i)] = k$ for each $i$ (i.e., the expected value is the same for each variable in the random sample), we can use $$\mathbb{E}\left[\dfrac{1}{N}\sum_{i=1}^{N}g(X_i)\right] = \dfrac{1}{N}(Nk)=k\text{,}$$ which means, that, therefore, $\dfrac{1}{N}\sum_{i=1}^{N}g(X_i)$ is an unbiased estimator of $k$. Use this to find an unbiased estimator of $\mu_2$.