Re:Introduction to Statistics using NumPy
by bckygldstn on Saturday September 09, 2017 @02:19PM
(#15208387)
The formula you give for variance is the sample variance, with N - 1 as the divisor. It gives an unbiased estimate of the variance of a population, assuming X is a sample of that much larger population.
However, by default numpy gives you population variance, with N as the divisor. This assumes X is the entire population, which is different from R and Matlab.
As a result, the answer in your code is different from the formula just above it.
However, by default numpy gives you population variance, with N as the divisor. This assumes X is the entire population, which is different from R and Matlab.
As a result, the answer in your code is different from the formula just above it.
gives 207, while gives 236. If you want the N-1 corrected sample variance from numpy you'd use