Statistics Formula Sheet Template (KaTeX, Verified in R and Python)
Course-wide statistics formula sheet in KaTeX – descriptive, probability, SEs, CIs, tests, ANOVA, regression, GLM links, effect sizes, power, Bayes – with use-when and common-slip notes
使い方: Use as a retrieval tool for a whole statistics course: cover each formula, recall it, then check, and redo one row of the numeric check table per day. Every number in the check table was verified in R and Python. The main pitfall is software defaults: scipy's ttest_ind is pooled while R's t.test is Welch, and both apply the Yates correction to 2 x 2 chi-square tables.
プレビュー
Statistics Formula Sheet: [Your course or exam]
A one-file formula sheet for a full introductory and intermediate statistics course: descriptive statistics, probability, distributions, standard errors, confidence intervals, the common tests, ANOVA, correlation and regression, logistic and Poisson links, effect sizes, power and Bayes' theorem. Every formula comes with a plain-language meaning, a "use when" rule and the most common slip, and a numeric check table whose numbers were verified in R and Python. It is for students preparing for exams, thesis writers who need a quick reference, and analysts checking software output by hand. It speeds up learning because you test yourself on it (cover the formula, recall it, check) instead of rereading it. The worked examples use fictional data; replace them with your own. Source basis: standard textbook formulas written in our own notation, checked against the NIST/SEMATECH e-Handbook of Statistical Methods and the original method papers.
Document control
| Field | Value |
|---|---|
| Course or project | [STAT 201 Inferential Statistics, Lakemoor University (fictional)] |
| Learner or analyst | [Your name] |
| Data set | Fictional check data typed in the code below (exam scores, study hours, library counts) |
| Software and versions | R 4.5.1 (base stats); Python 3.14 with numpy 2.5.4, scipy 1.18.1, statsmodels 0.15.0 |
| Date | YYYY-MM-DD |
| Version | [0.1] |
How to use this sheet
A formula sheet is most useful when you have already built the idea behind each formula. Each entry below follows the same order: what the quantity means in one sentence, the formula, when to use it, and the slip that students make most often. Read the meaning, close your eyes, and try to write the formula. Then check. If you got it wrong, write the slip into your error log (see academic/stats-error-log) and add a flashcard (see academic/stats-flashcards-spaced-review).
Three habits make the sheet pay off quickly. First, always ask "what is the standard error here?" because almost every interval and test is built as estimate plus or minus a critical value times a standard error, or as (estimate minus null value) divided by a standard error. Second, check the degrees of freedom before you look up a critical value. Third, after any computation, sanity-check the sign and the size: a correlation outside [-1, 1], a variance below zero or a p-value above 1 means an arithmetic slip, not a discovery.
Based on the NIST/SEMATECH e-Handbook of Statistical Methods and the original method papers listed under Sources; formulas are standard results written in our own notation. The self-testing use of the sheet follows the GAISE College Report (ASA 2016) recommendation to use assessments to improve and evaluate student learning.
Notation
| Symbol | Meaning | Symbol | Meaning |
|---|---|---|---|
| sample size | population size or total count | ||
| sample mean | population mean | ||
| sample standard deviation | population standard deviation | ||
| sample proportion | population proportion | ||
| SE | standard error of an estimate | df | degrees of freedom |
| significance level (0.05 here) | power | ||
| standard normal quantile with area below | t quantile with area below | ||
| , | null and alternative hypotheses | number of groups | |
| , | observed and expected counts | Pearson correlation | |
| , | regression intercept and slope | proportion of variance explained |
1. Descriptive statistics
The mean is the balance point of the data; the median is the middle value after sorting. The variance is the average squared distance from the mean, using so that the sample variance is an unbiased estimate of the population variance. The standard deviation is its square root and is in the units of the data.
- Use when: mean and SD for roughly symmetric data; median and IQR for skewed data or data with outliers.
- Common slip: dividing by instead of for a sample SD; reporting the SD when the question asks for the standard error (SE is the SD of the estimate, not of the data).
- Common slip: quartiles differ by software. R
quantile()defaults to type 7, which is also numpy's defaultlinearmethod; textbook hand methods often give slightly different quartiles. State the method if it matters.
2. Probability and Bayes' theorem
Probabilities of "or" events add (minus the overlap), probabilities of "and" events multiply (using the conditional probability unless the events are independent). Conditional probability restricts attention to the cases where the condition holds.
Bayes' theorem turns a probability of the evidence given a hypothesis into a probability of the hypothesis given the evidence:
- Use when: screening tests, diagnostic questions, "given that" wording, updating a belief with new evidence.
- Common slip: confusing with (the prosecutor's fallacy). A test that is 95% sensitive does not mean a positive result is 95% likely to be a true case: that depends on the base rate.
- Common slip: treating mutually exclusive events as independent. If and cannot both happen and both have positive probability, they are strongly dependent.
Counting: orderings of items; ways to choose of when order does not matter.
3. Distributions
The binomial counts successes in independent trials with the same success probability . The Poisson counts events in a fixed interval when they occur independently at a constant rate . The normal is the bell curve that sampling distributions of means approach.
- Use when: binomial for a fixed number of yes/no trials; Poisson for counts per time or space unit (loans per hour at Harbour City Library (fictional)); normal for continuous measurements and for large-sample statistics.
- Common slip: using the binomial when trials are not independent or changes; using the Poisson when the variance is much larger than the mean (overdispersion, see academic/stats-count-regression).
- Rules of thumb: 68%, 95% and 99.7% of a normal distribution lie within 1, 2 and 3 SDs of the mean. The exact two-sided 95% critical value is .
4. Sampling distributions and standard errors
A statistic computed from a random sample varies from sample to sample. Its standard deviation across repeated samples is the standard error. By the central limit theorem, the sampling distribution of a mean is close to normal for moderate even when the data are not, unless they are very skewed or have extreme outliers.
| Estimate | Standard error | Notes |
|---|---|---|
| Mean | uses sample SD | |
| Proportion | use in place of for a test | |
| Difference of means (Welch) | default for two independent groups | |
| Difference of means (pooled) | assumes equal variances | |
| Mean of paired differences | = number of pairs | |
| Difference of proportions (CI) | unpooled | |
| Regression slope | = residual SE |
- Use when: any time you build a CI or a test statistic.
- Common slip: the SE shrinks with , not with : four times the sample size halves the SE.
- Common slip: treating paired data as two independent groups throws away the pairing and usually inflates the SE.
5. Confidence intervals
A 95% confidence interval comes from a procedure that captures the true parameter in 95% of repeated samples. It gives the range of parameter values that are compatible with the data at that level.
- Use when: always report an interval with an estimate; a test alone hides the size and precision.
- Common slip: "there is a 95% probability that is in this interval" (for a frequentist CI the parameter is fixed; the 95% describes the procedure). A Bayesian credible interval does carry that meaning.
- Common slip: using instead of with small samples; the Wald interval for proportions near 0 or 1 or small (use Wilson).
6. Hypothesis tests
A test asks how surprising the observed statistic would be if the null hypothesis were true. The p-value is the probability, computed under , of a statistic at least as extreme as the one observed.
One-sample z and t:
Two independent groups: Welch (default) and pooled:
Paired: compute differences first, then a one-sample t on them.
Proportions:
Chi-square (goodness of fit and independence):
F for two variances: with .
- Use when: t for means with unknown (nearly always); z for proportions with large counts; chi-square for counts in categories; F for comparing variances or in ANOVA and regression.
- Common slip: R
t.test()defaults to Welch, whilescipy.stats.ttest_ind()defaults to pooled (equal_var=True). Setequal_var=Falsein Python to match R and this sheet. - Common slip: chi-square on percentages instead of counts; expected counts below 5 in many cells (use Fisher's
exact test); R
chisq.test()applies the Yates continuity correction to 2 x 2 tables by default, scipy'schi2_contingency()does too, so both differ from the hand formula unless you setcorrect = FALSE/correction=False. - Common slip: the F test for variances is very sensitive to non-normality; prefer Levene or Brown-Forsythe tests to check equal variances, or just use Welch.
7. ANOVA table
One-way ANOVA splits the total variation into variation between group means and variation within groups. If the group means are equal, both mean squares estimate the same error variance and their ratio is near 1.
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between groups | ||||
| Within groups (error) | ||||
| Total |
- Use when: three or more independent group means; follow with Tukey HSD (equal variances) or Games-Howell.
- Common slip: running all pairwise t-tests instead of ANOVA plus a controlled post hoc procedure (inflates the family-wise Type I error); forgetting that a significant F says "at least one mean differs", not which.
8. Correlation and regression
Correlation measures the strength of a straight-line association on a scale from -1 to 1. Simple linear regression fits the line that minimises the sum of squared vertical distances (residuals).
Test for a correlation: with (identical to the slope t-test in simple regression). Adjusted with predictors.
- Use when: for describing a linear association; regression for predicting from and estimating the change in per unit of .
- Common slip: in simple regression , but this does not hold for multiple regression with one predictor's . Correlation is not causation, and a correlation near 0 does not rule out a curved relation.
9. Logistic and Poisson regression links
Generalised linear models (Nelder and Wedderburn 1972) connect a linear predictor to the mean of the outcome through a link function.
- Use when: logistic for a binary outcome (passed or failed); Poisson for counts (loans per day).
- Common slip: reading from logistic regression as a change in probability. It is a change in log odds; is an odds ratio, and the change in probability depends on where you start.
10. Effect sizes
An effect size says how big a difference or association is, in units that do not depend on the sample size.
- Use when: or for two means (prefer for small samples); for paired designs; or for contingency tables; or for ANOVA ( is less biased); OR for 2 x 2 tables and logistic.
- Common slip: comparing (paired) with (independent) as if they were on the same scale; calling an effect "small" only because of Cohen's labels without considering the context.
11. Power and sample size approximations
Power is the probability of rejecting when a specified effect is real. It rises with the effect size, the sample size and , and falls with the variability.
- Use when: planning a study, checking whether a thesis sample is large enough for the smallest effect you care about.
- Common slip: the normal approximation slightly underestimates for t-tests (it gives 62.8 per group for , power 0.80; the exact t-based answer is 63.8, so 64 per group). Always round up. "Observed power" computed after the study from the observed effect adds nothing to the p-value.
Choosing a formula
The diagram below is a short version of the decision you make before reaching for any formula on this sheet: what type is the outcome, how many groups, and are the observations paired?
Why t and not z for small samples: the t critical value is wider when df is small and approaches 1.960 as df grows.
Worked numeric check
The numbers below come from four small fictional data sets typed into the code. Every value in the table was produced by both R 4.5.1 and Python 3.14 and the two agree to the shown precision (where the defaults differ, the table says which option was used).
- Exam scores at Lakemoor University (fictional), quiz section = 72, 85, 78, 90, 66, 81, 88, 75, 83, 79 and no-quiz section = 70, 68, 75, 80, 62, 73, 77, 65, 71, 69.
- Workshop scores for 8 students, before = 61, 70, 55, 68, 74, 59, 66, 72 and after = 66, 74, 58, 70, 80, 63, 65, 77.
- Study hours = 2, 4, 5, 3, 6, 8, 7, 9, 5, 10 and exam score = 60, 68, 64, 66, 74, 76, 82, 80, 70, 86.
- Library format by age at Harbour City Library (fictional): under 30, 18 print and 22 e-book; 30 and over, 30 print and 10 e-book. Three tutorial sections for ANOVA: 70, 74, 68, 72, 76 / 78, 82, 80, 76, 84 / 71, 69, 75, 73, 72.
| Quantity | Formula used | Inputs | Result |
|---|---|---|---|
| Mean, SD of | Section 1 | , | |
| Median, IQR of | type 7 quartiles | 80.0, 8.75 | |
| 95% CI for mean of | SE = 2.329, = 2.262 | [74.43, 84.97] | |
| One-sample t vs 75 | Section 6 | , | |
| Welch t, vs | Section 6 | SE = 2.898, = 16.59 | , , 95% CI [2.57, 14.83] |
| Pooled t, vs | Section 6 | , (.0077) | |
| Cohen's d, Hedges' g | Section 10 | , | |
| F for variances | 54.23 / 29.78 | , | |
| Paired t (after minus before) | Section 6 | , | , , 95% CI [1.66, 5.34], |
| One-proportion z, 32 of 40 vs 0.90 | Section 6 | SE = 0.0474 | , ; exact binomial |
| Two-proportion z, 45/60 vs 36/60 | Section 6 | , | |
| Chi-square 2 x 2, no correction | Section 6 | E = 24, 16, 24, 16 | , ; with Yates 6.30, |
| Cramér's V (here ), OR | Section 10 | , OR = 0.273 | |
| One-way ANOVA | Section 7 | , | , , , |
| Correlation | Section 8 | , , | , , , 95% CI [0.71, 0.98] |
| Regression | Section 8 | , , , , | |
| Logistic, , | Section 9 | , | , , OR = 1.649 |
| Poisson, , | Section 9 | , rate ratio 1.350 | |
| Power, , power 0.80 | Section 11 | approx. 62.8, exact 63.8, so 64 per group | |
| Proportion, margin 0.05 | Section 11 | 384.1, so 385 | |
| Bayes, prevalence 2%, sensitivity 95%, specificity 90% | Section 2 |
a <- c(72, 85, 78, 90, 66, 81, 88, 75, 83, 79)
b <- c(70, 68, 75, 80, 62, 73, 77, 65, 71, 69)
o1 <- t.test(a, mu = 75); c(o1$statistic, o1$p.value); o1$conf.int # one-sample t and 95% CI for the mean of a
tt <- t.test(a, b); c(tt$statistic, tt$parameter, tt$p.value) # Welch (R default)
tp <- t.test(a, b, var.equal = TRUE); c(tp$statistic, tp$parameter, tp$p.value)
pre <- c(61, 70, 55, 68, 74, 59, 66, 72); post <- c(66, 74, 58, 70, 80, 63, 65, 77)
tr <- t.test(post, pre, paired = TRUE); c(tr$statistic, tr$p.value); tr$conf.int
tab <- matrix(c(18, 30, 22, 10), 2)
chisq.test(tab, correct = FALSE) # hand formula, no Yates correction
g <- factor(rep(1:3, each = 5)); v <- c(70,74,68,72,76, 78,82,80,76,84, 71,69,75,73,72)
summary(aov(v ~ g))
x <- c(2, 4, 5, 3, 6, 8, 7, 9, 5, 10); y <- c(60, 68, 64, 66, 74, 76, 82, 80, 70, 86)
cor.test(x, y); summary(lm(y ~ x))
power.t.test(delta = 0.5, sd = 1, power = 0.8)
t
2.01820236 0.07433743
[1] 74.43188 84.96812
t df
3.001586672 16.593858603 0.008192356
t df
3.001586672 18.000000000 0.007658939
t
4.491822635 0.002825896
[1] 1.6575 5.3425
X-squared = 7.5, df = 1, p-value = 0.00617
Df Sum Sq Mean Sq F value Pr(>F)
g 2 213.3 106.67 12.8 0.00106 **
Residuals 12 100.0 8.33
t = 6.8664, df = 8, p-value = 0.0001288
95 percent confidence interval:
0.7060288 0.9823557
cor
0.9246268
Estimate Std. Error t value Pr(>|t|)
(Intercept) 54.9097 2.7926 19.662 4.66e-08 ***
x 2.9984 0.4367 6.866 0.000129 ***
Residual standard error: 3.408 on 8 degrees of freedom
Multiple R-squared: 0.8549, Adjusted R-squared: 0.8368
n = 63.76576
import numpy as np
from scipy import stats
import statsmodels.api as sm
from statsmodels.stats.power import TTestIndPower
a = np.array([72, 85, 78, 90, 66, 81, 88, 75, 83, 79])
b = np.array([70, 68, 75, 80, 62, 73, 77, 65, 71, 69])
w = stats.ttest_ind(a, b, equal_var=False) # Welch: set equal_var=False to match R
print(w.statistic, w.df, w.pvalue, w.confidence_interval())
sp = np.sqrt((9 * a.var(ddof=1) + 9 * b.var(ddof=1)) / 18)
d = (a.mean() - b.mean()) / sp
print("d", d, "g", d * (1 - 3 / (4 * 20 - 9)))
z = (32 / 40 - 0.9) / np.sqrt(0.9 * 0.1 / 40)
print("z", z, "p", 2 * stats.norm.sf(abs(z)), "exact", stats.binomtest(32, 40, 0.9).pvalue)
tab = np.array([[18, 22], [30, 10]])
c = stats.chi2_contingency(tab, correction=False)
print("chi2", c.statistic, c.pvalue, "V", np.sqrt(c.statistic / 80))
x = np.array([2, 4, 5, 3, 6, 8, 7, 9, 5, 10]); y = np.array([60, 68, 64, 66, 74, 76, 82, 80, 70, 86])
m = sm.OLS(y, sm.add_constant(x)).fit()
print(m.params, m.bse, m.rsquared)
print("n exact", TTestIndPower().solve_power(effect_size=0.5, alpha=0.05, power=0.8))
print("PPV", 0.02 * 0.95 / (0.02 * 0.95 + 0.98 * 0.10))
3.001586672066503 16.59385860302276 0.008192356439165922 ConfidenceInterval(low=np.float64(2.5733477091487904), high=np.float64(14.826652290851214))
d 1.3423503678196138 g 1.285631338193433
z -2.108185106778919 p 0.035014981019662564 exact 0.05668282561479828
chi2 7.5 0.006169899320544161 V 0.30618621784789724
[54.90968801 2.99835796] [2.79264343 0.43667048] 0.8549346723978959
n exact 63.765610588911635
PPV 0.16239316239316237
Note on Hedges' g: the correction factor equals with , so both forms give here.
Worked examples with fading
Example A (fully worked): Welch t by hand. Quiz section : , , . No-quiz section : , , .
- Variance of each mean: and .
- SE of the difference: .
- Statistic: .
- Welch df: .
- Critical value , so the 95% CI is .
- Report: the quiz section scored higher, t(16.59) = 3.00, p = .008, mean difference 8.7 points, 95% CI [2.57, 14.83], g = 1.29.
Example B (half solved): slope and R² by hand. Study hours and exam score: , , , , , , .
- Slope [ ].
- Intercept [ ] [ ].
- [ ].
- , so [ ].
- Interpretation: each additional study hour is associated with about [ ] more exam points.
Exercise C (unsolved). At Brightwell Bakery (fictional), 40 loaves were weighed and 32 passed the weight check. The bakery claims a 90% pass rate. Compute , the SE under , the z statistic and the two-sided p-value, and say why the exact binomial p-value differs.
Common slips and misconceptions
The slips in the sections above cluster into a few patterns that are worth naming, because naming a pattern helps you spot it in a new problem:
| Wrong move | Correct move |
|---|---|
| Using the SD where the SE is needed | SE = SD of the estimate, for a mean |
| Dividing by for a sample variance | divide by |
| Using with and unknown | use with |
| Treating paired data as independent | compute differences, then a one-sample t |
| Assuming R and Python give the same default | Welch in R, pooled in scipy; Yates correction on 2 x 2 tables in both |
| Reading a logistic as a probability change | exponentiate for an odds ratio |
| means a 3% chance that is true | it is the probability of data this extreme if were true |
| A 95% CI contains 95% of the data | it is about the parameter, not individual values |
| Non-significant means "no effect" | look at the CI: it may include large effects |
| Squaring the multiple-regression of one predictor to get | only in simple regression |
Self-test questions
- Write the standard error of a difference between two independent means without assuming equal variances.
- A sample of has . What is the SE of the mean, and how big must be to halve it?
- Write Bayes' theorem for and explain in one sentence why the base rate matters.
- In a 3 x 4 contingency table, what are the degrees of freedom for the chi-square test of independence?
- A logistic regression gives . What is the odds ratio for a one-unit increase in ?
- Why does
scipy.stats.ttest_ind(a, b)give a different p-value from R'st.test(a, b)on the same data?
My notes and next steps
| Formula I keep missing | Why I miss it | Card added (Y/N) | Re-test date |
|---|---|---|---|
| Example: Welch df | I forget to square the numerator | Y | YYYY-MM-DD |
| [Formula] | [Reason] | [ ] | YYYY-MM-DD |
Confidence with this sheet (1-5): [ ]. Open questions for the tutor: [Your questions]. Link your misses to academic/stats-error-log.
Sources and further reading
- NIST/SEMATECH e-Handbook of Statistical Methods, https://www.itl.nist.gov/div898/handbook/ (accessed 2026-10-25). Public domain.
- GAISE College Report ASA Revision Committee (2016). Guidelines for Assessment and Instruction in Statistics Education (GAISE) College Report 2016. American Statistical Association.
- Welch, B. L. (1947). The generalization of "Student's" problem when several different population variances are involved. Biometrika, 34(1–2), 28–35.
- Pearson, K. (1900). On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. Philosophical Magazine, Series 5, 50(302), 157–175.
- Fisher, R. A. (1925). Statistical Methods for Research Workers. Oliver and Boyd.
- Wilson, E. B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22(158), 209–212.
- Nelder, J. A., and Wedderburn, R. W. M. (1972). Generalized linear models. Journal of the Royal Statistical Society, Series A, 135(3), 370–384.
- Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum Associates.
- Hedges, L. V. (1981). Distribution theory for Glass's estimator of effect size and related estimators. Journal of Educational Statistics, 6(2), 107–128.
- Further reading (by name only): de Smith, M. J. (2024). Statistical Analysis Handbook, 2024 edition. StatsRef, https://www.statsref.com/; Diez, Çetinkaya-Rundel and Barr, OpenIntro Statistics.
Answer key
Example B: ; ; ; ; about 3.0
points per hour; R confint(lm(y ~ x)) gives a 95% CI for the slope of [1.99, 4.01].
Exercise C: . SE under : . , two-sided . The exact binomial test gives because it uses the discrete binomial
distribution directly; with only expected failures (well below the usual 10) the normal approximation is poor (R prop.test(32, 40, p = 0.9) warns
that the chi-squared approximation may be incorrect). Prefer the exact test or a Wilson interval here, and note that the two methods lead
to different decisions at , a reason to report the estimate and interval rather than only "significant".
Self-test:
- .
- . To halve it you need four times the sample size, .
- . When is rare, false positives from the large group of non-cases can outnumber true positives (PPV 0.162 in the check table).
- .
- : the odds are multiplied by about 1.65 per unit of .
- scipy's default is the pooled-variance t-test (
equal_var=True); R's default is Welch. Useequal_var=False.
Revision history
| Version | Date | Author | Change |
|---|---|---|---|
| 0.1 | YYYY-MM-DD | [Name] | First version from template |
| [0.2] | YYYY-MM-DD | [Name] | [Added formulas from week 8] |
関連テンプレート
Probability Distributions Reference Sheet Template (Statistics, R and Python)
Distributions reference: 16 discrete and continuous distributions with pmf/pdf, support, mean, variance and uses, a relationship map, R d/p/q/r and scipy.stats equivalents with parameterisation traps, verified lookups and a which-distribution self-test
学術Statistical Analysis Plan Template (Statistics, Thesis or Project)
Statistical analysis plan for a thesis or project: estimands, hypotheses, sample size, primary model, pre-set assumption fallbacks, missing data, multiplicity, sensitivity, deviations log
学術Statistical Analysis Report Template (Statistics, Thesis or Client)
Complete statistical analysis report for a thesis results chapter or client: plain-language summary, methods, descriptives, main analyses, assumption checks, sensitivity, limitations, reproducibility appendix, reviewer checklist