Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm learning multivariate analysis. I am asked to calculate covariance of $$X=\begin{pmatrix} 3&7 \\ 2&4 \\ 4&7 \end{pmatrix}$$

According to P8 of Applied Multivariate Statistical Analysis written by Richard A. Johnson,

$$s_{ik}=\frac{1}{n}\sum^{n}_{j=1}(s_{ji}-\bar{x}_i)(s_{jk}-\bar{x}_k)$$ $i=1,2,\ldots,p$ , $k=1,2,\ldots,p$.

However, when I using R to compute covariance. It is following this formula $$s_{ik}=\frac{1}{n-1}\sum^{n}_{j=1}(s_{ji}-\bar{x}_i)(s_{jk}-\bar{x}_k) $$

I do not know why they are difference? How to determine when to use $\frac{1}{n}$ or $\frac{1}{n-1}$ ?

share|cite|improve this question
Please use \sum for sums, instead of \Sigma. – Did Nov 24 '12 at 17:25
up vote 2 down vote accepted

The use of $n-1$ rather than $n$ is Bessel's correction.

To find the variance of a probability distribution that puts probability $1/n$ at each of $n$ points, you use $1/n$, not $1/(n-1)$. The denominator $n-1$ is used ONLY when estimating a population variance based on a sample variance. It makes the estimator unbiased.

Unbiasedness is slightly overrated. You get a smaller mean squared error with the biased estimator in which the denominator is $1/n$, and smaller still (in fact smallest possible) when it's $1/(n+1)$.

share|cite|improve this answer

Both estimators are consistent. The estimator with $1/(n-1)$ is unbiased.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.