Calculating the variance and standard deviation