11.2.1 Mean, Standard Deviation, and Variance

mean( x)
Arithmetic mean (sample mean) of x:

$\displaystyle \hat\mu = \frac{1}{N} \sum x_i$ (11.1)

variance( x)
Estimated (sample) variance of x:

$\displaystyle \hat\sigma^2 = \frac{1}{N-1} \sum (x_i - \hat\mu)^2$ (11.2)

This function computes the mean via a call to mean. If you have already computed the mean then you can pass it directly to variance_m.

variance_m( x, mean)
Estimated (sample) variance of x relative to mean:

$\displaystyle \hat\sigma^2 = \frac{1}{N-1} \sum (x_i - mean)^2$ (11.3)

sd( x)
sd_m( x, mean)
The standard deviation is defined as the square root of the variance of x. These functions returns the square root of the respective variance-functions above.

variance_with_fixed_mean( x, mean)
Compute an unbiased estimate of the variance of x when the population mean mean of the underlying distribution is known a priori. In this case the estimator for the variance uses the factor $ 1/N$ and the sample mean $ \hat\mu$ is replaced by the known population mean $ \mu$ :

$\displaystyle \hat\sigma^2 = \frac{1}{N} \sum (x_i - \mu)^2$ (11.4)