Find Variance Of Population Using Python

Variance:

Variance is one of the measures of dispersion. Variance of the population data tells how the data is dispersed around the population mean. The variance of the population is the arithmetic mean of the squared deviations from the mean value of the population.

The formula for finding the variance of the population data denoted by σ2 is given by

σ2 = i(1 to n) (xi-µ)2/N

 

Method Name:

pvariance(data)

 

Method Overview:

The Python variance() function returns the variance of the population data passed in as a sequence or as an iterator.

 

Python example for finding variance of a distribution:

# import the statistics module

 

import statistics

 

populationData = [126,122,130,124,121,121,125,132,137,118]

 

populationVariance = statistics.pvariance(populationData)

 

print("Population variance of the distribution is %.2f"%(populationVariance))

 

 

Example Python program output that finds the variance of a distribution:

Population variance of the distribution is 30.64

 


Copyright 2023 © pythontic.com