# Calculate expected value and standard deviation

Enter the values, separated by space or line breaks.

## Expected value

The expected value is essentially the same as the mean and is calculated in the same way. The difference is that expected value is used when working with random variables. The expected value is the average value (the mean) that is expected from running a large number of random experiments.

If the values that have been entered make up a list of all possible outcomes, and all outcomes are equally likely, the expected value will be calculated exactly. If the values are just a random sample the expected value will only be an approximation. A bigger sample is more likely to give a better approximation.

## Variance

The variance is a measure that describes how much the values are deviating from the expected value. It is calculated by squaring the difference between each value and the expected value, and then calculating the mean.

Example:
Calculate the variance of 2, 4 and 9.

First, the expected value has to be calculated.

2 + 4 + 9
3
=
15
3
= 5

When we know that the expected value is 5 the variance can be calculated as follows.

(2 − 5)² + (4 − 5)² + (9 − 5
3
=
(-3)² + (-1)² + 4²
3
=
9 + 1 + 16
3
=
26
3
≈ 8.67

This means that the variance is 8.67.

This way of calculating the variance works well when all the values are known, but when only a sample is available and the calculated variance is supposed to be an estimation for some bigger group of values (or a random variable) there is a tendency that the variance is underestimated. To prevent this it is common to instead divide by the number of values minus one when calculating the variance. You can force the tool to calculate the variance this way by selecting the "sample" option.

Example:
The age of three randomly selected oak trees in a forest is 2, 4 and 9 years. Estimate the age variance for all oak trees in the forest.

This example uses the same values as the previous example but since this is only a sample of the whole population we will estimate the variance by dividing by two instead of three.

(2 − 5)² + (4 − 5)² + (9 − 5
3 − 1
=
26
2
= 13

This means that we have estimated the variance to be 13.

Since the values are squared when calculating the variance the units become square units. In the example above we could have said that the variance was 13 years² (square years). This works fine for comparing different variances but the value itself doesn't tell us much. For this reason the standard deviation is often used instead of the variance.

## Standard deviation

Standard deviation is another measure for how much the values deviate from the expected value. It is calculated by taking the square root of the variance.

Standard deviation = √ variance

The standard deviation is easier to relate to, compared to the variance, because the unit is the same as for the original values. A variance of 13 years² correspond to a standard deviation of approximately 3.61 years. Note that this does not mean that the average deviation from the mean is 3.61 years.