Univariate Statistics – Understanding a Single Variable
Clinical research and laboratory medicine constantly generate measurements: a patient's systolic blood pressure before and after treatment, serum cholesterol levels across a cohort, or survival times following surgery. Before relationships between variables can be explored, each variable must first be understood on its own. This is the domain of univariate statistics — the systematic description, summarization, and visualization of a single variable.
Measures of Central Tendency
Central tendency refers to the "center" or typical value of a data distribution. The three most common metrics are the mean, median, and mode.
The Mean
The arithmetic mean (or average) is the sum of all observations divided by the total number of observations.
For a sample dataset $X = \{x_1, x_2, \dots, x_n\}$, the sample mean (denoted as $\bar{x}$) is calculated using the formula:
$$ \bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i $$Key Characteristic: The mean is highly sensitive to extreme values (outliers). A single massive value can pull the mean sharply in its direction, making it an unrepresentative "center" for heavily skewed data.
The Median
The median is the middle value when the data points are arranged in ascending or descending order.
- If the sample size $n$ is odd, the median is the exact middle value at position $\frac{n+1}{2}$.
- If $n$ is even, the median is the average of the two middle values at positions $\frac{n}{2}$ and $\frac{n}{2} + 1$.
Key Characteristic: Unlike the mean, the median is robust to outliers. If seven patients have a hospital length of stay of 3, 4, 4, 5, 5, 6, and 41 days (the last being a complex post-surgical case), the median is 5 days while the mean is about 10 days — a misleading picture of the typical patient.
Measures of Dispersion (Variability)
Knowing the center of the data is only half the story. We also need to know how "spread out" the data points are around that center.
Variance
Variance measures how far the data points are spread around the mean. The most natural measure of spread would be the average of all deviations $(x_i - \bar{x})$, but this always equals zero — the positive deviations above the mean exactly cancel the negative deviations below it. Squaring each deviation before averaging solves both problems at once: negative values become positive, and larger deviations contribute disproportionately more, giving appropriate weight to observations far from the center.
The sample variance ($s^2$) is given by:
$$ s^2 = \frac{1}{n-1} \sum_{i=1}^{n} (x_i - \bar{x})^2 $$Standard Deviation
Because variance is calculated using squared differences, its units are also squared (e.g., if your data is in meters, variance is in meters squared). To bring the measure back to the original scale of the data, we take the square root of the variance. This is the standard deviation ($s$):
$$ s = \sqrt{s^2} = \sqrt{\frac{1}{n-1} \sum_{i=1}^{n} (x_i - \bar{x})^2} $$A low standard deviation indicates that the data points tend to be close to the mean; a high standard deviation indicates that the data points are spread out over a wider range of values. Because the SD is expressed in the same units as the original data, it is directly interpretable: if the mean serum creatinine in a patient group is 90 µmol/L with an SD of 15 µmol/L, the typical patient is within 15 µmol/L of that mean.
For data that follow a normal (bell-shaped) distribution, the SD has a particularly useful property: approximately 68% of observations fall within one SD of the mean, about 95% within two SDs, and about 99.7% within three SDs. This is often called the 68–95–99.7 rule. It means that a result more than two SDs from the mean is genuinely unusual in a normally distributed population — a fact that underpins many reference ranges used in laboratory medicine.
Coefficient of Variation
The standard deviation is an absolute measure of spread — it is expressed in the same units as the data. This makes it unsuitable for comparing the variability of two measurements that differ in scale or units. The Coefficient of Variation (CV), also called the Relative Standard Deviation (RSD), solves this by expressing the standard deviation as a percentage of the mean:
$$ \text{CV} = \frac{s}{\bar{x}} \times 100\% $$Because the units in numerator and denominator cancel, the CV is dimensionless — a pure ratio that allows direct comparison of variability across different measurement scales.
Example: Two laboratory analyzers both measure a serum analyte. Analyzer A gives a mean of 5.0 mmol/L with an SD of 0.20 mmol/L; Analyzer B gives a mean of 50 U/L with an SD of 1.5 U/L. The SDs cannot be compared directly because the units differ. However, CVA = 0.20/5.0 × 100% = 4.0% and CVB = 1.5/50 × 100% = 3.0%, showing that Analyzer B is relatively more precise.
Use in the Clinical Laboratory
The CV is the standard metric for quantifying analytical imprecision in clinical laboratory quality control. It appears in two contexts:
- Within-run (repeatability) CV: Measures variability when the same sample is analyzed multiple times in a single analytical run under identical conditions.
- Between-run (reproducibility) CV: Measures variability across different runs, operators, or days. This is typically larger than the within-run CV and is the more clinically important figure, because it reflects what happens in routine practice.
Acceptable CV thresholds depend on the analyte and its clinical application. For many routine biochemistry tests (e.g., glucose, electrolytes), a between-run CV below 5% is generally expected. For tests used to detect small changes over time — such as high-sensitivity troponin for myocardial injury or haemoglobin A1c for glycaemic monitoring — the acceptable CV may be tighter still. A CV that exceeds the clinically allowable limit signals that the method's imprecision is large enough to cause misclassification of patients.
Manufacturers are required to state the CV of their assays; laboratories verify these claims during method validation and monitor them continuously through internal quality control programs using control materials of known concentration.
Limitation: The CV is only meaningful when the mean is substantially greater than zero and the data are on a ratio scale (i.e., zero represents true absence of the quantity). It cannot be meaningfully applied to temperatures expressed in degrees Celsius or Fahrenheit, or to data that include negative values.
Percentiles and Quartiles
To understand where a specific value stands relative to the rest of the dataset, we use measures of position.
- Percentiles: The $P$-th percentile is the value below which $P$ percent of the data falls. For example, if a newborn's birth weight is at the 85th percentile, the baby is heavier than 85% of newborns of the same gestational age.
- Quartiles: These divide the data into four equal quarters:
- First Quartile ($Q_1$): The 25th percentile.
- Second Quartile ($Q_2$): The 50th percentile (the Median).
- Third Quartile ($Q_3$): The 75th percentile.
- Interquartile Range (IQR): The distance between the first and third quartiles ($IQR = Q_3 - Q_1$). It captures the middle 50% of the data and is a robust measure of statistical dispersion.
Calculating a Percentile from Data
To find the value corresponding to the $p$-th percentile in a dataset of $n$ observations, first sort the data in ascending order. Then compute the rank $R$:
$$ R(p) = 0.5 + \frac{p \times n}{100} $$The rank $R$ locates the percentile value within the sorted dataset:
- If $R$ is a whole number, the percentile is the observation at rank $R$.
- If $R$ is not a whole number, let $i$ be the integer part of $R$ and $f$ the fractional part (so $R = i + f$). Interpolate between the observations at ranks $i$ and $i + 1$: $$ \text{Percentile} = x_i + f \times \left( x_{i+1} - x_i \right) $$
Example: Diastolic blood pressure is measured in $n = 20$ patients (sorted): 62, 65, 68, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 86, 88, 91, 95 mmHg. To find the 25th percentile (Q₁): $$ R(25) = 0.5 + \frac{25 \times 20}{100} = 0.5 + 5 = 5.5 $$ Since 5.5 is not a whole number, interpolate between the observations at ranks 5 and 6. The values are 71 and 72 mmHg: $$ \text{Q}_1 = 71 + 0.5 \times (72 - 71) = 71.5 \text{ mmHg} $$
Several different formulas for the rank $R(p)$ have been proposed in the literature. The formula above — $R(p) = 0.5 + pn/100$ — has been shown to be the best-performing method overall across a wide range of distributions and sample sizes (Schoonjans et al., 2011).
MedCalc calculates all these descriptive statistics in its Summary statistics procedure.
Standard Error of the Mean
When a study measures a sample of $n$ subjects to estimate a population mean, the sample mean $\bar{x}$ will not equal the true population mean $\mu$ exactly — it will differ by some random sampling error. The Standard Error of the Mean (SEM) quantifies how large that error is likely to be:
$$ \text{SEM} = \frac{s}{\sqrt{n}} $$where $s$ is the sample standard deviation and $n$ is the sample size. The SEM is the standard deviation of the theoretical distribution of all possible sample means drawn from the same population — the sampling distribution of the mean. By the Central Limit Theorem, this distribution is approximately normal regardless of the shape of the original data, provided $n$ is sufficiently large.
SEM vs. Standard Deviation: What Each Measures
The SD and the SEM are frequently confused, and the confusion has real clinical consequences. The key distinction lies in what each one describes:
- The Standard Deviation (SD) describes the variability of around the sample mean. It answers: The SD is a property of the data itself and does not systematically shrink as sample size grows — with very large $n$ it simply stabilizes at the true population standard deviation $\sigma$.
- The Standard Error of the Mean (SEM) describes the precision of as an estimate of the population mean. It answers: Because it contains $\sqrt{n}$ in the denominator, the SEM decreases as sample size increases — a larger study provides a more precise estimate of the mean.
The relationship between the two is direct:
$$ \text{SEM} = \frac{\text{SD}}{\sqrt{n}} $$Since $\sqrt{n} > 1$ for any practical sample, the SEM is always numerically smaller than the SD. This has led to a widespread and misleading practice: reporting SEM instead of SD in graphs and tables to make data appear less variable than it actually is. Reporting guidelines and major journals now recommend using the SD for descriptive purposes and reserving the SEM for inferential contexts — specifically, for constructing confidence intervals.
Example: A study measures fasting blood glucose in 25 patients: mean 5.6 mmol/L, SD 1.2 mmol/L. The SEM = 1.2 / √25 = 0.24 mmol/L. The SD of 1.2 mmol/L tells a clinician that individual patient values typically fall within about 1.2 mmol/L of the mean — a meaningful description of patient-to-patient variability. The SEM of 0.24 mmol/L tells a statistician that the sample mean of 5.6 mmol/L is likely within about 0.24 mmol/L of the true population mean — a measure of how precisely the study has estimated that average.
When to Report SD and When to Report SEM
- Use the SD when the goal is to the data — to characterize the spread of measurements or the variability within a patient population. This is the appropriate choice for descriptive tables in clinical papers.
- Use the SEM, or the confidence interval built from it (see below), when the goal is to — to make a statement about how precisely the population mean has been estimated. The confidence interval is generally preferred over the raw SEM because it is easier to interpret clinically.
Confidence Intervals
The standard error of the mean leads directly to the confidence interval (CI) — the most informative way to report a sample estimate. Rather than presenting the sample mean alone, a CI provides the point estimate together with a measure of its precision. A 95% CI for a population mean is:
$$ \bar{x} \pm z^* \cdot \frac{s}{\sqrt{n}} $$where $z^* = 1.96$ for a 95% interval (from the standard normal distribution). For small samples where $s$ is estimated from the data, $z^*$ is replaced by the corresponding quantile of the $t$-distribution with $n-1$ degrees of freedom, giving a slightly wider interval. Critical values can be found in the $z$-table and $t$-table appendices.
A narrow CI indicates that the sample mean has been estimated precisely; a wide CI signals substantial uncertainty — typically because the sample is small or the data are highly variable. Reporting CIs alongside point estimates, rather than SEM alone, is standard practice in clinical journals. The formal definition, the correct interpretation of "95% confidence", and the relationship between CIs and $p$-values are covered in the P-values and confidence intervals chapter.
When a study aims to achieve a pre-specified CI width rather than test a hypothesis, the required sample size can be calculated in advance. MedCalc provides a dedicated calculator: Sample size for a confidence interval of required width.