concept population variance in category data

appears as: population varice, population varice, n population variance
Data Science Bookcamp: Five Python Projects

This is an excerpt from Manning's book Data Science Bookcamp: Five Python Projects.

Listing 6.23. Estimating the population variance
normal_variance = std ** 2
estimated_variance = normal_variance * sample_size

Let’s compare the estimated variance to the population variance.

Listing 6.24. Comparing estimated variance to population variance
print(f"Estimated variance is approximately {estimated_variance:.2f}")
print(f"Actual population variance is approximately {population_variance:.2f}")
percent_diff_var = percent_diff(estimated_variance, population_variance)
print(f"There is a {percent_diff_var:.2f} percent difference between variances.")
Estimated variance is approximately 576.73
Actual population variance is approximately 584.33
There is a 1.30 percent difference between variances.

There is approximately a 1.3% difference between the estimated variance and the population variance. We’ve thus approximated the town’s variance to a relative accurate degree, while only sampling 2% of the people living in the town. Our estimates may not be 100% perfect. However, the amount of time we saved more than makes up for that miniscule drop in accuracy.