# Sample Covariance

I have a doubt with regards to sample covariance.

The sample covariance between two random variables x & y can be given as $\frac{1}{N} \sum_i{(x_i - \mu_x)(y_i - \mu_y)}$ assuming the mean's $\mu_x \text{ and } \mu_y$ are known. However if the means are known we estimate the sample means and have the new covariace as $\frac{1}{N-1} \sum_i{(x_i - \mu_x')(y_i - \mu_y')}$ where $\mu_x'$ and $\mu_y'$ are means computed from the data itself. The $(N-1)$ term accounts for Bessel's correction.

My question is what happens when we know exactly one mean of the two random numbers i.e $\mu_x$ or $\mu_y$ is exactly known and need not be computed from the data. What would be the correction term now?

• The approach should be straightforward: assume without loss of generality that $\mu_X=\mu_Y=0$ and consider $$\bar Y_N=\frac1N\sum_{i=1}^NY_i\qquad T_N=\sum_{i=1}^NX_i(Y_i-\bar Y_N)$$ then $E(X_iY_j)=0$ for every $i\ne j$ hence $$E(T_N)=\sum_{i=1}^N(1-1/N)E(X_iY_i)=(N-1)\mathrm{cov}(X,Y),$$ which shows that the proper normalization to get an unbiased estimator is $$\frac1{N-1}\sum_{i=1}^N(X_i-\mu_X)(Y_i-\bar Y_N).$$ – Did May 24 '16 at 12:14
• @Cm7F7Bb For every $(\mu_X,\mu_Y)$, the random variable in my comment is an unbiased estimator of $\mathrm{Cov}(X,Y)$, not of $E(XY)$. The formula in your comment is wrong: to see this, assume that $(X_i)$ is independent of $(Y_i)$, then the LHS is $0$ while the RHS is $E(X)E(Y)$. – Did May 24 '16 at 14:12