Standard error vs margin of error vs SD, explained
Standard deviation, variance, standard error, margin of error and IQR: what each measures, how they connect, and which to report, with a worked example.
Updated . Written by Matt Gencer.
On this page
Standard deviation describes how spread out your observations are. Standard error describes how precisely you have estimated a statistic such as the mean. Margin of error is the standard error stretched by a critical value into a plus-or-minus range. The three get mixed up because they share a formula, so this guide takes the spread and precision measures one at a time, with one worked example behind all of them.
Each section opens with the definition, then a number, then the mistake that most often goes with it. For how these feed a test result, see p-values and confidence intervals.
The worked example
The numbers below come from one seeded run of the Celeus engine on synthetic data: the score change between two attempts at a quiz for 100 units, one row each, independent of each other. No real participants are involved. The engine has no descriptive-summary method, so the run is a paired t-test of the score change against a column of zeros, which is the same arithmetic as a one-sample t-test against zero. That single run gives the mean (2.13 points), the t statistic (1.665 on 99 degrees of freedom), the 95% confidence interval (-0.41 to 4.67) and Cohen’s d (0.17).
The standard deviation, variance, standard error and margin of error are not printed by the engine under those names. Each follows from the printed outputs by one line of arithmetic, shown in its section. The quartiles come from base R and are labelled so. The package behind the example reproduces the engine numbers, and the base R lines work on its data file.
Standard deviation
The standard deviation is the typical distance of an individual observation from the mean, in the same units as the data. It describes the sample, and it does not shrink as you collect more data: it settles on the true spread of the population.
The engine reports Cohen’s d, which is the mean divided by the standard deviation. Here d = 0.1665 and the mean is 2.132, so the standard deviation is 2.132 / 0.1665 = 12.80 points. About two thirds of the changes sit within 12.8 points of the mean, a wide spread next to a mean of 2.1.
In base R it is one call, sd(x), where x is the score-change column. R divides by n minus 1, the sample standard deviation, which is the right choice for a sample.
The n minus 1 matters. The population standard deviation divides the squared distances by n, which is right only when you hold every unit in the population. A sample’s values sit closer to their own mean than to the true population mean, so dividing by n understates the spread; dividing by n minus 1 corrects that for the variance, which makes the sample variance an unbiased estimate. In the example the n version would give 12.74 instead of 12.80. The gap is a rounding detail at n = 100 and a real difference at n = 5, which is why software that offers both is worth checking against your intent.
The common mistake is using it as a measure of precision. A standard deviation says nothing about how well the mean is known, and a small one is not evidence of a precise estimate unless n is also large.
Variance
The variance is the standard deviation squared, in squared units: the average squared distance from the mean, again with n minus 1 in the denominator. It matters because variances add for independent values, and because ANOVA and Levene’s test work in variances. It is a poor choice for describing data to a reader, because squared quiz points mean nothing.
From the example, the variance is 163.97 squared points (12.805 squared, before rounding); in base R that is var(x). Report the standard deviation, which is back in the original units.
The squared units are the reason for that advice. A variance of 163.97 squared points cannot be placed on the same axis as the scores or the mean, and it cannot be compared with a margin of error in points. Taking the square root restores the scale, so the standard deviation can be read as a distance from the mean, which is why papers report it rather than the variance. Variance keeps its place in the working: pooling the spread of two groups, for example, takes a degrees-of-freedom-weighted average of their variances, not of their standard deviations.
The common mistake is mixing the two up in a table: a column headed “SD” that holds variances, or the reverse. State which one it is. For when unequal variances across groups matter and how to check, see homogeneity of variance.
Standard error of the mean
The standard error of the mean is the standard deviation of the sample mean across repeated samples of the same size: how much a mean computed from n units would typically move if you drew a fresh sample. Its formula is the standard deviation divided by the square root of n.
The engine’s t statistic is the mean divided by the standard error, so the standard error is 2.132 / 1.665 = 1.28 points. That matches 12.80 / sqrt(100) = 1.28, and in base R sd(x) / sqrt(length(x)) gives the same value. Unlike the standard deviation, the standard error depends on n. Holding the standard deviation at 12.80, a sample of 25 would give a standard error of 2.56 and a sample of 400 would give 0.64. To halve the standard error you need four times the data.
The shrinking has a shape worth seeing in these hypothetical samples, which hold the standard deviation at 12.80. Going from 25 units to 100 halves the standard error (2.56 to 1.28), and going from 100 to 400 halves it again (1.28 to 0.64). Each halving costs four times the sample, so precision gets expensive quickly, and a plan that aims for a very narrow estimate needs the sample size worked out in advance. In real data the standard deviation would only settle toward the population value as n grows; more data sharpen your knowledge of the spread without making the spread smaller.
The formula assumes independent observations. Clustered or repeated measurements break that and usually make it too small (too optimistic). The standard error of a regression coefficient or of a difference between groups has its own formula, though the idea is the same.
The common mistake, documented for decades in journals, is reporting “mean (SEM)” to describe the participants. Because the standard error is smaller than the standard deviation by a factor of the square root of n, it makes the data look tighter than they are. Altman and Bland put it plainly: the standard deviation describes the spread of the observations, and the standard error describes the precision of the mean (Altman and Bland, 2005). To show spread, use the standard deviation. To show precision, show a confidence interval.
Reporting guidance converges on the same advice. Statistical reporting guidelines for biomedical journals tell authors to summarise approximately normal data with the mean and standard deviation, and never to use the standard error to show the variability of a data set (Lang and Altman, 2015). The American Physiological Society’s guidelines say that variability should be described with the standard deviation, not the standard error (Curran-Everett and Benos, 2004). A survey of four anaesthesia journals found that about one in four articles (23%) used the standard error of the mean to describe the variability of a sample (Nagele, 2003). Conventions differ between journals, so check the author instructions of the one you are writing for.
Margin of error
The margin of error is the half-width of a confidence interval: the standard error multiplied by a critical value for the confidence level you chose. Add it to the estimate and subtract it from the estimate and you have the interval.
For a mean from a sample of 100, the 95% critical value is the t quantile on 99 degrees of freedom, 1.984. Then 1.984 x 1.28 = 2.54 points, and the engine’s interval is 2.132 plus or minus 2.54, which is -0.41 to 4.67. With a large sample, 1.96 is a fine approximation (1.96 x 1.28 = 2.51 here), but for small n the t value is noticeably larger, so 1.96 makes the interval too narrow.
Two points keep it honest. First, a 95% margin of error is a property of the procedure: 95% of intervals built this way, over repeated samples, would cover the true mean. It is not a 95% probability that this interval does (Greenland et al., 2016), and it is not the range where 95% of individual values fall. Second, it covers random sampling error only. A biased sample, poor measurement or non-response is not shrunk by a larger n.
The margin of error and the confidence interval are the same object described two ways: the interval is the estimate plus and minus the margin. That also fixes how the sample size acts on it. With n = 25 the standard deviation of 12.80 would give a margin of 5.29 points, with n = 100 it is 2.54, and with n = 400 it is 1.26. The critical value falls a little as n grows (2.06, 1.98, 1.97), but nearly all of the narrowing comes from the square root of n in the standard error. Error bars drawn on a figure follow the same arithmetic: for a sample of about ten or more, a 95% interval reaches about two standard errors either side of the mean, and a figure must say which kind of bar it shows (Cumming, Fidler and Vaux, 2007).
The common mistake is reporting a margin of error without its confidence level, or quoting a poll’s “plus or minus” as if it applied to every subgroup. A subgroup has fewer units, so its standard error and margin are larger. The interval here crosses zero, so this sample does not rule out no average change (p = 0.099); see how to write a confidence interval conclusion for wording that does not over-claim.
Interquartile range
The interquartile range, or IQR, is the distance between the 25th and 75th percentiles: the width of the middle half of the data. It is the spread measure that goes with the median, and it does not need a symmetric distribution.
In base R, quantile(x, c(0.25, 0.75)) gives -6.3 and 11.8 for the example, and IQR(x) is 18.1 points. For roughly normal data the IQR is about 1.35 standard deviations, and 18.1 / 12.80 = 1.41, close to that. When the two disagree strongly, the data are probably skewed or carry extreme values, and the standard deviation is the one that gets pulled. The same IQR defines the usual outlier fences; how to apply them is covered in the IQR rule for outliers.
The practical gain is robustness. Suppose one entry error added a single score change of 200 to the 100 values. The standard deviation would jump from 12.80 to 23.45 and the mean from 2.13 to 4.09, while the IQR would move only from 18.1 to 18.6 and the median from 1.35 to 1.5. One value is enough to nearly double the standard deviation, whereas the middle half of the data barely notices it. That is a reason to look at both whenever they disagree, not a reason to drop the standard deviation: for roughly symmetric data it carries more information and feeds directly into the standard error and the usual tests. One more detail: quartiles can be computed in several ways, and R’s default (type 7) is one of nine documented definitions (Hyndman and Fan, 1996), so other software can give noticeably different quartiles, especially on small samples; on this example’s data, type 6 puts the upper quartile at 12.1 rather than 11.8.
The common mistake is pairing the wrong centre with the spread: the mean with the IQR, or the median with the standard deviation. Match them. Use mean and standard deviation for symmetric data, and median and IQR (ideally the two quartiles themselves) for skewed data. Like the standard deviation, the IQR describes the data and does not shrink with n.
Why SD vs SE matters in reporting
Spread and precision answer different questions, and a results section needs the right one in the right place.
- To describe the sample, as in a baseline table, report the mean and standard deviation, or the median and quartiles. Include n.
- To describe how well an effect or a mean is estimated, report the estimate with its confidence interval. This is what the margin of error summarises, and it carries more than a bare standard error does.
- If you do report a standard error, label it “SE” or “SEM”, say which statistic it belongs to, and keep it out of the table of participant characteristics.
- To compare groups on a standardised scale, the effect size divides by a pooled standard deviation, not a standard error. See Cohen’s d vs Hedges’ g.
Write the convention out where the number first appears, in the form “mean 2.1 (SD 12.8)” or “mean 2.1, 95% CI -0.4 to 4.7”, rather than leaving the bracket to be decoded. The same applies to tables and to the notes under figures.
A reader who sees “2.1 (1.3)” cannot tell whether 1.3 is a standard deviation or a standard error, and here the two differ by a factor of ten. That ambiguity is the whole problem. A free check: if the bracketed value would shrink when you double the sample, it is a standard error.
Which summary fits which analysis is part of choosing the test in the first place; see the guide on choosing a statistical test, and for keeping the numbers re-runnable, reproducible statistical analysis. The framing is research statistics throughout: these summaries describe a sample and the precision of an estimate, and say nothing about any individual.
Worked example
Data: synthetic, generated in the script below. Seed: 20261023.
Run on Celeus engine 0.31.1, seed 20261023, synthetic data.
Output
# Results - Test: Paired t-test - n: 100 - statistic: 1.665 - p-value: 0.0991 - effect size: Cohen's d = 0.1665 (95% CI -0.03128 to 0.3634) - 95% CI: [-0.4088, 4.673] - seed: 20261023 ## Assumption checks - normality (Shapiro-Wilk): passed=TRUE (no evidence against normality) - sample size: passed=TRUE (adequate n) ## Power (sensitivity, not observed power) - minimum detectable effect at n=100: Cohen's d = 0.2829 - to detect a conventional medium effect: 34 pairs to detect d=0.50 - alpha = 0.05, target power = 0.8
R script
# Celeus - reproduce.R (run from this package folder; bundled data in data/)
# Test: Paired t-test | engine 0.31.1 | catalog c39-d3cd
# Research context: not provided for this run.
# Reproduces the recorded result deterministically.
set.seed(20261023)
.data_path <- "data/standard-error-vs-margin-of-error.csv"
if (!file.exists(.data_path)) stop("Run reproduce.R from the package folder (the bundled data is in data/).")
data <- readr::read_csv(.data_path, show_col_types = FALSE) # needs the readr package
clean_cells <- function (df)
{
ctrl_collapse <- "[\r\n\t\v\f]+"
zero_width_chars <- intToUtf8(c(8203L, 65279L), multiple = TRUE)
uni_space_chars <- intToUtf8(c(160L, 8239L, 8199L), multiple = TRUE)
clean_text <- function(x) {
out <- x
for (ch in zero_width_chars) out <- gsub(ch, "", out,
fixed = TRUE)
out <- gsub(ctrl_collapse, " ", out)
for (ch in uni_space_chars) out <- gsub(ch, " ", out,
fixed = TRUE)
trimws(gsub(" +", " ", out))
}
changed_cols <- character(0)
cells_cleaned <- 0L
retyped <- character(0)
for (j in seq_along(df)) {
col <- df[[j]]
if (!is.character(col))
next
cleaned <- clean_text(col)
n_changed <- sum(!is.na(col) & !is.na(cleaned) & col !=
cleaned, na.rm = TRUE)
if (n_changed > 0L) {
changed_cols <- c(changed_cols, names(df)[j])
cells_cleaned <- cells_cleaned + n_changed
}
df[[j]] <- cleaned
non_blank <- cleaned[!is.na(cleaned) & nzchar(cleaned)]
if (length(non_blank) && all(grepl("^[+-]?(0|[1-9][0-9]*)([.][0-9]+)?$",
non_blank))) {
parsed <- suppressWarnings(as.numeric(cleaned))
was_blank <- is.na(cleaned) | !nzchar(cleaned)
lost <- (is.na(parsed) | is.infinite(parsed)) & !was_blank
if (!any(lost)) {
finite <- parsed[!is.na(parsed)]
all_whole <- all(finite == floor(finite))
in_range <- all(abs(finite) <= .Machine$integer.max)
df[[j]] <- if (all_whole && in_range)
as.integer(parsed)
else parsed
retyped <- c(retyped, names(df)[j])
}
}
}
names(df) <- clean_text(names(df))
if (length(changed_cols)) {
attr(df, "ingest_clean_columns") <- changed_cols
attr(df, "ingest_clean_cells_cleaned") <- cells_cleaned
}
if (length(retyped))
attr(df, "ingest_clean_retyped") <- retyped
df
}
data <- clean_cells(data)
# Complete-case analysis: drop rows missing any analysis value.
.acols <- c("score_change", "reference_value")
data <- data[stats::complete.cases(data[, .acols, drop = FALSE]), , drop = FALSE]
result <- t.test(data[["score_change"]], data[["reference_value"]], paired = TRUE)
print(result)
# Sensitivity: minimum detectable effect at n=100 (power=0.8, alpha=0.05). NOT observed power.
power <- pwr::pwr.t.test(n = 100, sig.level = 0.05, power = 0.8, type = "paired")
print(power)Common questions
What is the difference between standard error and margin of error?
The standard error is the typical size of the sampling error in an estimate, such as a mean. The margin of error is that standard error multiplied by a critical value for a chosen confidence level, so it is the plus-or-minus half-width of the confidence interval.
Is standard error the same as standard deviation?
No. The standard deviation describes how spread out the individual observations are. The standard error describes how precisely a statistic, usually the mean, is estimated. The two are linked by dividing the standard deviation by the square root of the sample size.
Should I report the standard deviation or the standard error?
Report the standard deviation to describe your sample, and a confidence interval, or a standard error labelled as such, to describe the precision of an estimate. Never use the standard error to describe how variable the participants or units are.
How do I calculate the margin of error from the standard error?
Multiply the standard error by the critical value for your confidence level. For a mean from a small or moderate sample use the t critical value with n minus 1 degrees of freedom; for 95 percent confidence with a large sample, 1.96 is close.
When is the interquartile range better than the standard deviation?
Use the interquartile range when the data are skewed or have extreme values, because the middle half of the data is barely moved by a few outliers. Pair it with the median, and use the standard deviation with the mean when the distribution is roughly symmetric.
Sources
- Altman DG, Bland JM (2005). Standard deviations and standard errors. BMJ 331(7521):903. doi:10.1136/bmj.331.7521.903
- Nagele P (2003). Misuse of standard error of the mean (SEM) when reporting variability of a sample. A critical evaluation of four anaesthesia journals. British Journal of Anaesthesia 90(4):514-516. doi:10.1093/bja/aeg087
- Lang T, Altman D (2015). Basic statistical reporting for articles published in biomedical journals: the Statistical Analyses and Methods in the Published Literature, or SAMPL, guidelines. International Journal of Nursing Studies 52(1):5-9. doi:10.1016/j.ijnurstu.2014.09.006
- Curran-Everett D, Benos DJ (2004). Guidelines for reporting statistics in journals published by the American Physiological Society. American Journal of Physiology-Endocrinology and Metabolism 287(2):E189-E191. doi:10.1152/ajpendo.00213.2004
- Cumming G, Fidler F, Vaux DL (2007). Error bars in experimental biology. The Journal of Cell Biology 177(1):7-11. doi:10.1083/jcb.200611141
- Hyndman RJ, Fan Y (1996). Sample quantiles in statistical packages. The American Statistician 50(4):361-365. doi:10.1080/00031305.1996.10473566
- Student (1908). The probable error of a mean. Biometrika 6(1):1-25. doi:10.2307/2331554
- Greenland S, Senn SJ, Rothman KJ, Carlin JB, Poole C, Goodman SN, Altman DG (2016). Statistical tests, P values, confidence intervals, and power: a guide to misinterpretations. European Journal of Epidemiology 31(4):337-350. doi:10.1007/s10654-016-0149-3
Methods discussed
Try it on your own data
Upload a dataset and Celeus suggests a method, checks its assumptions, runs it in R, and gives you the script to rerun it.
Try it in Celeus