# Sample variance calculator

# Sample variance

Sample variance is a statistical measure that represents the degree of variability or dispersion of a set of data points from their mean or average value. It is calculated by taking the average of the squared differences of each data point from the mean.

**Here is the formula for sample variance:**

s^2 = Σ(x – x̄)^2 / (n – 1)

**Where:**

- s^2 is the sample variance
- x is each data point
- x̄ is the mean or average value of the data set
- n is the number of data points in the sample

**To calculate the sample variance, follow these steps:**

- Calculate the mean of the data set by adding up all the data points and dividing by the number of data points.
- Subtract the mean from each data point.
- Square each difference.
- Add up the squared differences.
- Divide the sum of squared differences by (n – 1), where n is the number of data points in the sample.

For example, let’s say we have the following data set:

{10, 15, 12, 18, 20}

**To calculate the sample variance:**

- Calculate the mean: x̄ = (10 + 15 + 12 + 18 + 20) / 5 = 15
- Subtract the mean from each data point: (10 – 15) = -5, (15 – 15) = 0, (12 – 15) = -3, (18 – 15) = 3, (20 – 15) = 5
- Square each difference: (-5)^2 = 25, 0^2 = 0, (-3)^2 = 9, 3^2 = 9, 5^2 = 25
- Add up the squared differences: 25 + 0 + 9 + 9 + 25 = 68
- Divide the sum by (n – 1): s^2 = 68 / (5 – 1) = 17

Therefore, the sample variance of this data set is 17.