How to calculate sample variance in statistics