# Calculating the variance of sample, knowing the mean of population

Suppose that I somehow know the mean of the population. And I want to calculate the variance of a sample. Should I subtract population mean or sample mean? Is there any situation in which I should use population mean?

• I think the question is somewhat unclear. Do you want to calculate the variance in the sample? Do you want to estimate the expected variance of the sample mean (i.e. variance in the mean if you repeated the sampling procedure)? Or do you want to obtain the best possible estimate for the population variance given your observed sample and prior knowledge of the population mean? – Jacob Socolar Dec 25 '18 at 15:29
• I want to calculate the variance in the sample with respect to the population mean. I am considering a situation in which sample mean is very low, while population mean is very high. So, I thought that if I used population mean, I may conclude or have and indicator that the sample is abnormal, by comparing using sample mean (this is the objective). Honestly I am not sure if this approach is "good". Maybe I should look at the means only, keeping things simple. – Ali Slais Dec 26 '18 at 6:23

No one would like to use sample estimator, when population parameter is known. So, if population mean is given, then use population mean, but then use $$n$$ in denominators instead of $$n-1$$ because no degree of freedom will be lost in this case.
So, sample variance (when population mean is not known) $$s^2 = \frac{1}{n-1}\sum_{i = 1}^{n}\left(X_i - \bar X \right)^2$$
So, sample variance (when population mean is known) $$s^2 = \frac{1}{n}\sum_{i = 1}^{n}\left(X_i - \mu \right)^2$$ where, $$\mu$$ is population mean.