Chapter 3 of 22 Statistics guide · Part 1: The basics

Descriptive Statistics: Mean, Median, Mode, Variance, Range and IQR

Before any test, describe your data: where the values center, how much they spread, and what shape they take. This chapter works through the measures of central tendency and dispersion, skewness, kurtosis and outliers, using the daily gains of the 24 pigs.

  • Plant and animal examples
  • Worked by hand and in R
  • Sources cited
  • Free tools to try it

Quick answers

What are descriptive statistics?
Numbers and graphs that summarize a dataset: its center (mean, median, mode), its spread (range, IQR, variance, SD, CV) and its shape (skewness, kurtosis).
What are the measures of central tendency?
The mean (the average), the median (the middle value when sorted) and the mode (the most common value). Use the median when data are skewed or have outliers.
What are the measures of dispersion?
Range (max − min), interquartile range (Q3 − Q1), variance, standard deviation and coefficient of variation. SD is the one most reported in trials.
How do you calculate variance and standard deviation?
Subtract the mean from each value, square, add them up and divide by n − 1: that is the variance. The standard deviation is its square root, in the original units.
What is the interquartile range?
The spread of the middle half of the data: the 75th percentile minus the 25th. It ignores extreme values, so outliers barely affect it.
How do you find outliers?
A common rule flags values below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR. Check flagged values for recording errors; never delete one just because it is inconvenient.
On this page
  1. Quick answers
  2. The data
  3. Measures of central tendency: mean, median and mode
  4. Measures of dispersion: range, IQR, variance and standard deviation
  5. Shape: skewness and kurtosis
  6. Outliers: finding them and what to do
  7. Summarizing by treatment
  8. Key takeaways
  9. Questions people ask
  10. Sources

The data

Measures of central tendency: mean, median and mode

  • Mean (arithmetic average): the sum divided by n. It uses every value, which makes it efficient, but one extreme value can pull it.
  • Median: the middle value of the sorted data (the average of the two middle values when n is even). Half the values lie below it.
  • Mode: the most frequent value. Useful for categories (the most common body condition score); rarely used for measurements.

When data are skewed, the mean is pulled toward the long tail. Somatic cell counts, weed counts and parasite egg counts are typical: a few very high values raise the mean well above the median. Report the median, or analyze with a model suited to counts.

Measures of dispersion: range, IQR, variance and standard deviation

Two diets can have the same mean but very different consistency. Dispersion measures describe that spread.

  • Range = max − min. Simple, but it depends only on the two most extreme values and grows with sample size.
  • Percentiles and quartiles: Q1 (25th percentile), the median (50th) and Q3 (75th). The interquartile range IQR = Q3 − Q1 covers the middle half.
  • Variance, the average squared distance from the mean:

s² = Σ(x − x̄)² / (n − 1) and SD = s = √s²

The standard deviation is in the same units as the data, which is why it is reported rather than the variance. To compare variability between traits with different means, use the coefficient of variation. To show how precisely a mean is known, use the standard error.

n
6
Mean
0.803
Standard deviation (SD)
0.0924
Standard error (SE)
0.0377
Coefficient of variation (CV)
11.5%

SD uses n − 1 (the sample standard deviation, as Excel's STDEV.S and R's sd() do). SE = SD / √n. CV = SD / mean × 100.

Shape: skewness and kurtosis

  • Skewness measures asymmetry. Positive skew means a long tail to the right (most counts and concentrations); negative skew, a long tail to the left. Zero is symmetric.
  • Kurtosis (excess kurtosis, as most software reports it) compares the tails with a normal distribution, which scores 0. Positive values mean heavier tails and a sharper peak; negative values, lighter tails and a flatter shape.

For ANOVA what matters is the shape of the residuals (each value minus its group mean), not the raw data pooled over treatments. The Normality Test reports skewness and kurtosis with a Shapiro-Wilk test and a Q-Q plot.

Outliers: finding them and what to do

The 1.5 × IQR rule draws fences around the middle half of the data. Values outside are flagged as possible outliers; box plots draw them as single points.

  1. Check the record first: a typo (9.1 for 0.91), a wrong unit, or a swapped column explains many outliers.
  2. Check the animal or plot: a sick pig, a flooded corner of the field. Exclude only for a documented reason, decided by rules you would apply to any unit.
  3. If the value is real, keep it. Report the analysis with and without it if it changes the conclusion.

Summarizing by treatment

In a report, give descriptive statistics for each treatment, not just overall:

Graphs help as much as tables: a histogram or box plot per treatment shows spread and outliers at a glance.

In R

dat <- read.csv("pig-feeding-trial.csv")
summary(dat$adg)                      # min, quartiles, median, mean, max
sd(dat$adg); var(dat$adg); IQR(dat$adg)
aggregate(adg ~ diet, data = dat, FUN = function(x) c(mean = mean(x), sd = sd(x), n = length(x)))
boxplot(adg ~ diet, data = dat)

In SAS

proc means data=pigs n mean median std var min max q1 q3 qrange skew kurt maxdec=3;
  class diet;
  var adg;
run;

Key takeaways

  • Center: mean for symmetric data, median for skewed data or data with outliers.
  • Spread: SD is the standard; the IQR resists outliers; CV compares traits with different means.
  • Variance divides by n − 1 for a sample; SD is its square root, in the data's units.
  • Skewness and kurtosis near zero suggest a bell shape; for ANOVA check the residuals.
  • Investigate outliers, but delete one only for a documented reason.

Questions people ask

Should I report the mean or the median?

The mean for roughly symmetric data such as weights and yields; the median (with the IQR) for skewed data such as counts, concentrations or survival times.

Why do Excel, R and SAS give slightly different quartiles?

There are several accepted ways to interpolate percentiles. The differences are small and shrink with larger samples; state the software you used.

What is the difference between variance and standard deviation?

SD is the square root of the variance. Variance is in squared units (kg² per day²), SD in the original units, which makes it easier to read.

Can the standard deviation be larger than the mean?

Yes, for skewed data with many small values, such as weed counts. It signals that a mean ± SD summary, or a normal-based analysis, may be a poor fit.

What is a five-number summary?

Minimum, Q1, median, Q3 and maximum: exactly what a box plot draws.

Sources

  • Kaps, M., and Lamberson, W. R. (2017). Biostatistics for Animal Science (3rd ed.), chapter 1, Presenting and summarizing data. CABI.
  • Tukey, J. W. (1977). Exploratory Data Analysis. Addison-Wesley.
  • Hyndman, R. J., and Fan, Y. (1996). Sample quantiles in statistical packages. The American Statistician, 50(4), 361–365.