Skip to content

Formulas

Statistics and probability

Mean, median, spread, shares and probability: how to sum up data.

  • Data & AI
  • Mathematics

The middle of data

  • Mean

    mean = sum of all values / number of values

    For 2, 4 and 9: (2 + 4 + 9) ÷ 3 = 5. A single outlier can shift it a lot.

    To the lesson: Mean and median

  • Median

    median of 1, 3, 8, 10, 40 = 8

    Put the values in order of size and take the one in the middle. With an even number of values it lies halfway between the two middle ones. Outliers hardly move it.

    To the lesson: Mean and median

  • Mode

    mode of 3, 5, 5, 7, 9 = 5

    The value that turns up most often. There can be more than one.

How far data spread

  • Range

    range = largest value − smallest value

    For 3, 5, 5, 7, 9: 9 − 3 = 6.

  • Variance

    variance = sum of (value − mean)² / number of values

    The mean of the squared distances from the mean. For a sample you often divide by the number minus 1.

  • Standard deviation

    The square root of the variance. It says how far the values typically lie from the mean, in the same unit as the values. It is often called σ.

Frequencies and shares

Probability

  • Probability

    P = favorable outcomes / all outcomes

    Works when all outcomes are equally likely. Rolling a 6 with a die: {1/6}.

  • From impossible to certain

    A probability lies between 0 and 1. 0 means impossible, 1 means certain, {1/2} is as likely as heads when you toss a coin.

  • Complement

    P(not A) = 1 − P(A)

    Not rolling a 6: 1 − {1/6} = {5/6}.

  • Twice in a row

    P(A and B) = P(A) · P(B)

    When the two do not affect each other. Two 6s in a row: {1/6} · {1/6} = {1/36}.

Data and AI

  • Data & AI
  • Accuracy of a model

    accuracy = correct answers / all answers

    Measured on test data the model did not see during training. Often given in percent: 45 out of 50 right is 90%.

    To the lesson: Training and testing

Learn about it

In these subjects, lessons explain what you see here.