Skip to course content
Free R statistics course

Statistical Data Analytics with R

Unit 04.02: Two different spreads

The standard deviation describes the spread of values. The standard error describes the spread of your estimate. Confusing them is the single most common error in applied statistics.

Two different spreads

The standard deviation is a property of the data: how far individual values sit from their mean. It does not shrink as you collect more data, because the population's variability is what it is.

The standard error is a property of an estimate: how far a sample mean would sit from the truth across repeated samples. It falls as n grows, because larger samples pin the mean down more tightly.

SE = SD / sqrt(n) connects them, and that square root is the reason precision is expensive: quadrupling the sample halves the standard error, so each further halving costs four times as much again.

This block computes both from one sample and then verifies the formula by simulation.

set.seed(103)
population <- rnorm(200000, mean = 500, sd = 100)

sample_30 <- sample(population, 30)

cat("Standard deviation describes the SPREAD OF VALUES:\n")
cat("  SD of this sample of 30:", round(sd(sample_30), 2), "\n\n")

cat("Standard error describes the SPREAD OF THE ESTIMATE:\n")
se_formula <- sd(sample_30) / sqrt(30)
cat("  SE = SD / sqrt(n) =", round(se_formula, 2), "\n\n")

# The formula is not an assumption -- simulation confirms it.
simulated <- sd(replicate(4000, mean(sample(population, 30))))
cat("Simulated SD of 4000 sample means:", round(simulated, 2), "\n")
cat("Formula estimate from one sample :", round(se_formula, 2), "\n\n")

cat("Quadrupling n halves the standard error:\n")
for (n in c(30, 120, 480)) {
  cat(sprintf("  n = %3d  SE = %.2f\n", n, sd(population) / sqrt(n)))
}
cat("\nThat is why precision gets expensive. Halving it again needs n = 1920.\n")

The sample of 30 has a standard deviation of 95.75, giving a standard error of 17.48. Simulating 4000 sample means directly gives a spread of 17.98 — the formula, computed from a single sample, recovers what repeated sampling would have shown. The last block makes the cost visible: SE falls from 18.23 at n = 30 to 9.12 at n = 120 and 4.56 at n = 480, and halving it once more would need n = 1920.

The mistake this prevents

The mistake is quoting the standard error as though it described the spread of the data. It makes the data look far more consistent than it is, and the error grows with sample size.

Takeaway

Use the standard deviation to describe the data and the standard error to describe the precision of an estimate. Always label which one a figure or an error bar shows.