Mean
Sum
Count
Median
Data
View

More information about the essential statistics

Statistics essentials: ten concepts every data scientist uses

Data science rests on a handful of statistical ideas. The mean, median and mode say what is typical, the variance and standard deviation how far the data spread, probability how likely an outcome is, correlation and regression how two variables move together, and hypothesis tests and confidence intervals how much a sample can tell about the world. Here each concept gets its own picture on the same sample, with its definition, its formula worked out with the sample's numbers and three things it is used for.

How it works

  1. Choose one of the ten concepts, or All 10 to see them side by side.
  2. Pick a dataset and the sample size; New sample draws another sample from the same population.
  3. Turn on Add an outlier to see which statistics it pulls along and which stay put.
  4. Read the figures in the information panel and the definition, the formula with your numbers and the uses in the card.

The centre: mean, median and mode

Three numbers answer the question what is typical. The mean

\[\bar{x}=\frac{\sum x_{i}}{n}\]

adds everything up and shares it out equally; it is the balance point of the data, which is why one extreme value can drag it far.

The median is the middle value of the sorted data and ignores how extreme the extremes are, so it is the better summary of skewed data such as incomes, house prices and response times. The mode is the most frequent value, and the only one of the three that works for categories such as the best-selling product.

The spread: variance and standard deviation

Two samples can have the same mean and still look nothing alike. The variance

\[s^{2}=\frac{\sum (x_{i}-\bar{x})^{2}}{n-1}\]

is the average squared deviation from the mean: draw a square on every deviation and it is their average area.

Dividing by \(n-1\) instead of n corrects for the sample's own mean being closer to the data than the true mean. Its square root, the standard deviation s, is back in the data's units: for bell-shaped data about 68 % of the values lie within one s of the mean, 95 % within two and 99.7 % within three.

Chance and relationships: probability, correlation and regression

A probability is a number from 0 to 1; for a continuous variable it is an area under the density curve,

\[P(a\le X\le b)=\Phi (z_{2})-\Phi (z_{1})\]

under a normal model. The correlation coefficient r measures how closely two variables follow a straight line, from −1 to 1, by adding up the products of their deviations: points in the quadrants where both are above or both below their means push r up.

Linear regression finds the line ŷ = \(b_{0}+b_{1}x\) with the smallest sum of squared residuals; its slope says how much y changes per unit of x, and \(R^{2}=r^{2}\) how much of the variation the line explains.

From a sample to the world: hypothesis tests and confidence intervals

A sample is never the whole population, so every statistic wobbles from sample to sample. A hypothesis test asks whether a difference is larger than that wobble: assume there is no effect (H₀), compute how surprising the data would be (the p-value) and reject \(H_{0}\) when p falls below the significance level \(\alpha\), as in an A/B test.

A confidence interval \(\bar{x}\pm t\)* · \(s/\sqrt{n}\) turns the same idea into a range: 95 % of such intervals, from repeated samples, contain the true mean, and the app draws them so you can count the ones that miss.

Frequently asked questions

What are the most important statistics concepts for data science?

The ten in this app cover most day-to-day work: the mean, median and mode for the centre of the data, the variance and standard deviation for its spread, probability for uncertainty, correlation and regression for relationships between variables, and hypothesis tests and confidence intervals for drawing conclusions about a population from a sample, such as in an A/B test.

When should I use the median instead of the mean?

When the data are skewed or contain outliers. The mean is the balance point of all values, so one very large value pulls it along, while the median only depends on the order of the values. That is why typical incomes, house prices and response times are reported as medians. Turn on Add an outlier and compare the two.

Why does the sample variance divide by n − 1?

Because the deviations are measured from the sample's own mean, which always lies closer to the data than the true mean does. Dividing by n would make the variance too small on average; dividing by \(n-1\) (Bessel's correction) makes it unbiased. The Population variance tile shows the value divided by n for comparison.

What does a p-value mean?

It is the probability of getting a difference at least as large as the one observed if there were really no effect (the null hypothesis \(H_{0}\)). A small p-value, below the significance level \(\alpha\), means the data would be surprising under \(H_{0}\), so \(H_{0}\) is rejected.

It is not the probability that \(H_{0}\) is true, and a large p-value does not prove that there is no effect: the sample may just be too small.

What does a 95 % confidence interval mean?

That the method catches the true value 95 % of the time: if you drew many samples and computed an interval from each, about 95 in 100 would contain the true mean. The app draws such repeated samples; the intervals that miss the true mean \(\mu\) are red. Any single interval either contains \(\mu\) or not.

Can I use the picture?

Yes. Save gives a PNG at the size you choose, and the pencil opens the picture in the PictorX photo editor with the background, the axes, the data, the statistic and the card on layers of their own, and the title, definition, formula, calculation and uses as editable text. Save JSON writes the sample and every figure.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Go to Editor