aNet.ai
Data Science/Learning path
0day streak0XP · Lv 1
← 2. Describing Data
Lesson 3.3 7 min · 174 words

Variance and standard deviation

Standard deviation, or SD, describes how much values spread around the mean. Variance is the step before taking the square root.

Let n be the number of observed values, and x-bar their mean. A deviation is x_i minus x-bar. Squaring makes negative and positive deviations contribute positively.

Sample variance: sum of squared deviations divided by n-1. Sample SD: square root of sample variance. Population-style variance: divide by n when describing the entire listed population or following a specified scaling convention.

The n-1 correction accounts for estimating the mean from the same sample. Under the usual independent random-sample assumptions it makes sample variance unbiased for population variance. It does not guarantee every sample estimate is too small before correction, and sample SD itself is not exactly unbiased.

Variance has squared units, such as points squared. SD returns to points. SD describes dispersion of observations; it is not the standard error of a mean and not a typical prediction error.

Pandas Series.std() defaults to ddof=1; NumPy's ordinary array SD defaults to ddof=0. With missing values, also choose matching missing-value handling before comparing implementations. One observed value is insufficient for sample SD; a constant group has SD zero.

Sources: W2 PDF pp. 2-60; L2 Sections 1-8. The personalised Lab 2 has 240 synthetic students, unlike the 1,200-student lecture dataset. Do not mix their numbers.

Practice problems

Supplementary study questions on the lecture concepts — not verbatim exam questions. Each answer counts toward spaced review.

1. Conceptual understanding

Definitions and distinctions.

Question 1 of 6 · +5 XP

If scores are in points, what are the units of sample variance?

Question 2 of 6 · +5 XP

Which divisor is used by sample variance for n observations?

2. Application

Apply the concept to a case or calculation.

Question 3 of 6 · Deviations · +5 XP

For [2,4,6], which deviations from the mean are correct?

Question 4 of 6 · Squared deviations · +5 XP

For deviations −2,0,2, what is the sum of squares?

3. Interpretation and limitations

Evaluate assumptions and justify conclusions.

Question 5 of 6 · Sample SD · +5 XP

What is the sample SD for [2,4,6]?

Question 6 of 6 · Zero spread · +5 XP

All five observed values are 10. What is their SD?

Explain it in writing

Self-checked, not marked. Write a few sentences, then compare with the example answer. Your writing is saved as you type.

Show an example answer

Deviations are measured in the original unit. Squaring them produces squared units. Taking the square root returns SD to the original unit.

Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?

Show an example answer

Not with the usual n−1 formula: the divisor is zero. You need at least two observations for that sample-SD calculation.

Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?

Practice this topic
Saved in this browser as you type.
aNet.ai · Data Science Fundamentals · Weeks 1–5 · practice material, not an official examProgress saved in this browser