Find a Formula
Type a name or concept below, or click a category tag to filter. All formulas remain visible to search engines regardless of the filter state.
Quick Statistics Formulas Table
The table below lists the most commonly needed formulas in one place. Each formula is explained in depth in the sections that follow. Note that the appropriate formula for a confidence interval depends on the estimation method, distribution, and assumptions — the general form shown here is a framework, not a universal recipe.
| Topic | Formula | Notes |
|---|---|---|
| Mean | x̄ = Σx / n | Sample mean; use μ = Σx/N for population |
| Weighted Mean | x̄w = Σwx / Σw | Each observation multiplied by its weight |
| Range | Maximum − Minimum | Sensitive to extreme values |
| Sample Variance | s² = Σ(x − x̄)² / (n − 1) | n−1 gives unbiased estimate of σ² |
| Population Variance | σ² = Σ(x − μ)² / N | Use when data is the entire population |
| Sample SD | s = √s² | Same units as the data |
| Population SD | σ = √σ² | Same units as the data |
| IQR | Q3 − Q1 | Spread of the middle 50% of data |
| Z-Score | z = (x − μ) / σ | Standard deviations from the population mean |
| Standard Error of Mean | SE = s / √n | SD of the sampling distribution of x̄ |
| Conditional Probability | P(A|B) = P(A ∩ B) / P(B) | P(B) must be > 0 |
| Bayes' Theorem | P(A|B) = P(B|A)P(A) / P(B) | Updates prior probability with new evidence |
| Binomial Probability | C(n,k) × p^k × (1−p)^(n−k) | Fixed trials, two outcomes, independent |
| Poisson Probability | e^(−λ) × λ^k / k! | Event counts in a fixed interval |
| Confidence Interval | Estimate ± Critical Value × SE | Critical value depends on distribution and method |
| One-Sample t | t = (x̄ − μ₀) / (s/√n) | df = n − 1 |
| Welch Two-Sample t | t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) | Does not assume equal variances |
| Paired t | t = d̄ / (sd/√n) | Applied to paired differences d = X − Y |
| Chi-Square | χ² = Σ[(O−E)²/E] | O = observed, E = expected frequency |
| ANOVA F | F = MSB / MSW | Between-group MS over within-group MS |
| Pearson Correlation | r = Σ(x−x̄)(y−ȳ) / √[Σ(x−x̄)²Σ(y−ȳ)²] | Linear association; −1 ≤ r ≤ 1 |
| Regression | ŷ = b0 + b1x | b1 = slope; b0 = intercept |
| Multiple Regression | ŷ = b0 + b1x1 + ... + bkxk | Each bj holds others constant |
| Relative Risk | RR = Risk₁ / Risk₀ | Ratio of two risks; not the same as OR |
| Odds Ratio | OR = Odds₁ / Odds₀ | Distinct from relative risk; see Section 14 |
Statistical Notation
Statistics uses different symbols for samples and populations. Confusing them is one of the most common errors in introductory courses. The table below defines the notation used throughout this page. Note that some symbols have more than one meaning depending on context — β is one example, which can denote a regression coefficient, a standardized coefficient, or the probability of a Type II error.
| Symbol | Meaning |
|---|---|
| μ | Population mean |
| x̄ | Sample mean |
| σ | Population standard deviation |
| s | Sample standard deviation |
| σ² | Population variance |
| s² | Sample variance |
| n | Sample size |
| N | Population size |
| p | Population proportion or p-value (context-dependent) |
| p̂ | Sample proportion |
| α | Significance level (or Type I error rate) |
| β | Context-dependent: regression coefficient or Type II error probability |
| r | Sample Pearson correlation coefficient |
| ρ | Population Pearson correlation coefficient |
| R² | Coefficient of determination (regression) |
| SE | Standard error |
| df | Degrees of freedom |
| Σ | Summation |
| H₀ | Null hypothesis |
| H₁ / Ha | Alternative hypothesis |
| ε | Error term (regression residual) |
Descriptive Statistics Formulas
Descriptive statistics summarize and describe the features of a dataset. These formulas are the foundation for almost every other method. Before applying them, identify whether your data represents a sample or an entire population, since the formulas differ. Detailed guides to each measure are available in the descriptive statistics section.
Arithmetic Mean
The mean is the sum of all observations divided by the count of observations. It is the most common measure of center but is sensitive to extreme values.
x̄ = sample mean
Σx = sum of all observations
n = number of observations
When to use it: When data is quantitative and you want the arithmetic center. Use the population version (μ = Σx/N) when data covers every member of the population.
Dataset: 10, 12, 14, 16, 18
Sum: 10 + 12 + 14 + 16 + 18 = 70
Count: n = 5
Mean: x̄ = 70 / 5 = 14
The mean is 14. Each value in this evenly spaced dataset falls an equal distance from the center, so the mean equals the median.
Weighted Mean
w = weight of each observation
x = observation value
When to use it: When observations contribute unequally — for example, final grades where exams count more than homework, or survey data with sampling weights. A simple mean would misrepresent the data when group sizes or importance levels differ.
Example: Three exams with scores 70, 80, 90 and weights 0.2, 0.3, 0.5. Weighted mean = (0.2×70 + 0.3×80 + 0.5×90) / (0.2+0.3+0.5) = (14+24+45)/1 = 83.
Median and Mode
The median is the middle value when observations are sorted in order. With an odd number of observations, it is the value at position (n+1)/2. With an even number, it is the average of the two middle values. The median is more resistant to extreme values than the mean. See the full median guide.
The mode is the value that appears most often. A dataset can be unimodal (one mode), bimodal (two modes), multimodal (more than two modes), or have no mode if no value repeats. See the mode guide for details. Also see the comparison at mean vs median vs mode.
Range
Maximum = largest value
Minimum = smallest value
Limitation: The range depends entirely on the two most extreme values. A single outlier can inflate it considerably, which is why IQR is often preferred for describing spread. See the range guide.
Sample and Population Variance
Variance measures the average squared deviation from the mean. The two formulas differ because of how degrees of freedom work. The full explanation is in the variance guide.
x = each observation
x̄ = sample mean
n − 1 = degrees of freedom
The denominator n−1 rather than n makes s² an unbiased estimator of the population variance σ². When n is used instead, the estimator systematically underestimates σ² because the sample mean x̄ is closer to the sample values than μ is. The population formula σ² = Σ(x−μ)²/N uses N and the true population mean μ, and should only be used when data covers the entire population.
Dataset: 10, 12, 14, 16, 18 (same dataset as Example 1; x̄ = 14)
Deviations: 10−14=−4; 12−14=−2; 14−14=0; 16−14=2; 18−14=4
Squared deviations: 16, 4, 0, 4, 16
Sum of squared deviations: 16+4+0+4+16 = 40
Sample variance: s² = 40/(5−1) = 40/4 = 10
Sample SD: s = √10 ≈ 3.162
s² = 10; s ≈ 3.162. These describe the typical spread around the mean in the same units as the original data.
Standard Deviation
Standard deviation is the square root of variance, so it is expressed in the same units as the original data. A larger standard deviation means observations are more spread out. For a deeper guide see standard deviation.
Standard deviation (s or σ) describes the spread of individual observations. Standard error (SE = s/√n) describes how precisely the sample mean estimates the population mean. They are not interchangeable. See standard deviation vs standard error.
Coefficient of Variation
CV expresses variability relative to the mean. It can help compare variability across variables measured on different scales. However, CV is problematic when the mean is zero or near zero, and it is not meaningful on scales without a true zero. See coefficient of variation.
Quartiles, IQR, and Five-Number Summary
The IQR describes the spread of the middle 50% of observations. Q1 is the 25th percentile and Q3 is the 75th. Different software packages use slightly different algorithms for computing quartiles — this means Q1 and Q3 values can vary between tools for the same dataset. State which convention you are using if precision matters. See interquartile range.
The five-number summary is: Minimum, Q1, Median, Q3, Maximum. It provides a compact description of the distribution and is the basis for box plots. See five-number summary.
The conventional box-plot outlier fences are:
Z-Score Formula
x = observed value
μ = population mean
σ = population standard deviation
The z-score gives the number of population standard deviations an observation lies from the population mean. A positive z means the observation is above the mean; negative means below; zero means it equals the mean. Z-scores allow comparisons across different scales. When population parameters are unknown, some contexts use sample estimates (x̄ and s) as substitutes, but the result is then a standardized score rather than a true z-score. See z-score for a full guide and see the z-table for critical values.
A student scores 82 on a test. The class population mean is μ = 74 and population SD is σ = 8.
Identify values: x = 82, μ = 74, σ = 8
Calculate: z = (82 − 74) / 8 = 8/8 = 1.0
z = 1.0. The student scored exactly one population standard deviation above the class mean.
Probability Formulas
Probability formulas quantify uncertainty. They form the theoretical basis for sampling distributions, confidence intervals, and hypothesis tests. For a deeper treatment see statistics and probability and the probability rules guide.
Key Probability Rules
The addition rule subtracts the intersection to avoid double-counting. For mutually exclusive events (which cannot both occur), P(A ∩ B) = 0 so the rule simplifies to P(A ∪ B) = P(A) + P(B). See mutually exclusive events.
These are different concepts. Independent events: P(A ∩ B) = P(A)P(B) — both can occur, but knowing one happened tells you nothing about the other. Mutually exclusive events: P(A ∩ B) = 0 — they cannot both occur. Non-trivial mutually exclusive events are never independent. See independent vs dependent events.
Bayes' Theorem
P(A) = prior
P(B|A) = likelihood
P(B) = evidence (marginal)
P(A|B) = posterior
Bayes' theorem updates a prior belief P(A) with observed evidence to produce a posterior belief P(A|B). In a diagnostic setting it can be used to compute the probability of disease given a positive test result, but this requires careful attention to disease prevalence. See the Bayes' theorem guide and Bayes' theorem calculator.
Counting Formulas
See permutations and combinations for detailed examples and the combination calculator.
Probability Distribution Formulas
Binomial Distribution
n = fixed number of trials
k = number of successes
p = probability of success per trial
Mean: μ = np
Variance: σ² = np(1−p)
Conditions: Fixed number of trials n; each trial has exactly two outcomes; probability of success p is constant across trials; trials are independent. See binomial distribution and the binomial calculator.
A fair coin is flipped 5 times. What is the probability of exactly 3 heads?
Identify: n = 5, k = 3, p = 0.5
C(5,3): 5! / [3!×2!] = 120 / 12 = 10
P(X=3): 10 × (0.5)³ × (0.5)² = 10 × 0.125 × 0.25 = 10 × 0.03125 = 0.3125
P(X = 3) = 0.3125. There is a 31.25% chance of getting exactly 3 heads in 5 fair coin flips.
Poisson Distribution
λ = expected number of events
k = actual event count (0,1,2...)
Mean = λ; Variance = λ
Use the Poisson distribution for counting events in a fixed interval of time or space, when events occur independently at a constant average rate. See Poisson distribution and the Poisson calculator.
Normal Distribution
The normal distribution is fully described by its mean μ and standard deviation σ. Its probability density function is:
In practice, normal distribution problems use z-scores and the z-table rather than this density formula directly. For introductory courses, memorizing this formula is usually not required. See normal distribution.
Empirical rule (for approximately normal data): approximately 68% of observations fall within 1 SD of the mean, about 95% within 2 SDs, and about 99.7% within 3 SDs. These are approximations, not exact figures. See empirical rule and the empirical rule calculator.
Sampling and Standard Error Formulas
Standard Error of the Mean
s = sample SD
n = sample size
SE shrinks as n grows
The standard error of the mean is the standard deviation of the sampling distribution of x̄. It quantifies how much sample means vary from sample to sample. As sample size grows, SE shrinks because larger samples produce more stable estimates. See standard error.
Other common standard errors: for a proportion, SE(p̂) = √[p̂(1−p̂)/n]; for a difference between two independent means, SE = √(s₁²/n₁ + s₂²/n₂). The appropriate formula depends on the parameter being estimated.
When sampling without replacement from a finite population, the finite population correction (FPC) may apply: FPC = √[(N−n)/(N−1)], multiplied by SE. This matters when the sample is a large fraction of the population (roughly more than 5%).
The central limit theorem states that the sampling distribution of the mean approaches normality as n increases, regardless of the shape of the original population distribution. This is why SE-based formulas work broadly in practice.
Confidence Interval Formulas
A confidence interval gives a range of plausible values for an unknown population parameter. The standard frequentist interpretation is: if this procedure were repeated many times on independent samples, the interval would contain the true parameter value in the stated percentage of repetitions. It does not mean there is a 95% probability that this specific interval contains the parameter. See confidence intervals.
One-Sample Mean (unknown σ)
t* = t critical value with df = n−1
s/√n = SE of the mean
This is the standard interval when population SD σ is unknown (the usual situation in practice). The critical value t* comes from the t-distribution table with df = n−1. See confidence interval for mean and the confidence interval calculator.
A sample of n=16 observations has x̄ = 50 and s = 8. Construct a 95% confidence interval for the population mean.
df: n − 1 = 15
t* (95%, df=15): from the t-table, t* ≈ 2.131
SE: 8 / √16 = 8/4 = 2.0
Margin of error: 2.131 × 2.0 = 4.262
Interval: 50 ± 4.262 → (45.738, 54.262)
95% CI: (45.74, 54.26). Under repeated sampling with this procedure, about 95% of such intervals would contain the true population mean.
Proportion Confidence Interval
The basic Wald interval is p̂ ± z* × √[p̂(1−p̂)/n], where z* is the normal critical value (1.96 for 95%). This is the form most often seen in introductory textbooks, but it has known coverage problems in small samples or when p̂ is near 0 or 1. The Wilson score interval and the Clopper-Pearson interval often provide better coverage in these situations. See proportion CI and Wilson score interval.
Margin of Error
The margin of error is the half-width of a confidence interval. See margin of error and the margin of error calculator.
Hypothesis Testing Formulas
Every test statistic follows the general structure: (Observed estimate − Null value) / Standard Error. The resulting value is then compared to a reference distribution to obtain a p-value or compared to a critical value. For background see hypothesis testing.
A p-value does not give the probability that H₀ is true, the probability that the result occurred by chance, or the probability that the alternative hypothesis is true. See p-values. Also see statistical interpretation.
One-Sample t-Test
x̄ = sample mean
μ₀ = null hypothesis value
s = sample SD
n = sample size
df = n − 1
A manufacturer claims boxes weigh μ = 500 g on average. A sample of n = 25 boxes gives x̄ = 492 g and s = 15 g. Test at α = 0.05 (two-tailed).
H₀: μ = 500 | H₁: μ ≠ 500
SE: 15/√25 = 15/5 = 3.0
t: (492 − 500)/3.0 = −8/3 = −2.667
df = 24; from the t-table, critical value ≈ ±2.064
Decision: |−2.667| = 2.667 > 2.064 → Reject H₀. The p-value is approximately 0.013.
At α = 0.05, there is sufficient evidence that the mean box weight differs from 500 g. See the full one-sample t-test guide.
Welch Two-Sample t-Test
The degrees of freedom for the Welch test are estimated by the Welch-Satterthwaite formula, which most software computes automatically. The pooled-variance form requires assuming σ₁² = σ₂², an assumption that is often untestable in practice. The Welch form is generally recommended unless there is strong justification for equal variances. See Welch t-test, two-sample t-test, and equal vs unequal variance.
Paired t-Test
d = X − Y for each pair
d̄ = mean of differences
sd = SD of differences
df = n − 1 (pairs, not total observations)
Use the paired test when observations are naturally linked (before/after measurements on the same subject, matched pairs). Applying an unpaired test to paired data ignores the correlation structure and gives wrong answers. See paired t-test.
Type I and Type II Errors
| Term | Definition | Rate |
|---|---|---|
| Type I Error (false positive) | Reject H₀ when it is true | α (significance level) |
| Type II Error (false negative) | Fail to reject H₀ when it is false | β |
| Power | Correctly reject a false H₀ | 1 − β |
| Correct non-rejection | Fail to reject H₀ when it is true | 1 − α |
See type I and type II errors.
Chi-Square Formula
O = observed frequency in each cell
E = expected frequency under H₀
Sum over all cells in the table
The chi-square test is used for testing independence between categorical variables and for goodness-of-fit tests. Expected frequencies are calculated from marginal totals under the null hypothesis. A common rule of thumb is that expected cell counts should generally be at least 5; when this is not met, Fisher's exact test is often more appropriate. See chi-square test and the chi-square calculator.
Observed: Cell A=30, B=20, C=10, D=40. Expected: A=25, B=25, C=15, D=35.
Cell contributions: (30−25)²/25 = 1.0 | (20−25)²/25 = 1.0 | (10−15)²/15 = 1.667 | (40−35)²/35 = 0.714
χ²: 1.0 + 1.0 + 1.667 + 0.714 = 4.381
df = (rows−1)(cols−1) = 1. Critical value at α=0.05 from the chi-square table is 3.841.
χ² = 4.381 > 3.841 → reject H₀ at α = 0.05. Evidence of an association between the two categorical variables.
ANOVA Formulas
Analysis of variance tests whether the means of three or more groups differ. A significant overall F test indicates that at least one group mean differs from the others — it does not identify which groups differ. Post hoc tests (such as Tukey HSD or Bonferroni) are required for pairwise comparisons. See ANOVA.
Here k = number of groups, N = total number of observations. dfB = k−1, dfW = N−k, dfT = N−1. The F-statistic compares variability between groups to variability within groups. Use the F-table for critical values or the ANOVA calculator.
Three groups with means ȳ₁=10, ȳ₂=14, ȳ₃=12. Overall mean ȳ=12. n₁=n₂=n₃=4 (N=12). SSW=36.
SSB: 4(10−12)²+4(14−12)²+4(12−12)² = 4(4)+4(4)+0 = 32
dfB = k−1 = 2; dfW = N−k = 9
MSB: 32/2 = 16; MSW: 36/9 = 4
F: 16/4 = 4.0
Critical value F(2,9) at α=0.05 ≈ 4.26. Since 4.0 < 4.26, we fail to reject H₀ at this level.
Insufficient evidence to conclude that the group means differ at α = 0.05. Post hoc tests would only follow if H₀ were rejected.
Correlation Formulas
Pearson Correlation
Pearson r measures the strength and direction of the linear association between two quantitative variables. It does not imply causation. A strong correlation can exist with no causal relationship, and a causal relationship can produce a weak correlation if the relationship is nonlinear. See Pearson correlation, the correlation vs causation guide, and the correlation calculator.
Spearman Rank Correlation
Spearman's rho is the Pearson correlation coefficient applied to the ranks of the data rather than the raw values. It measures monotonic association. For the special case with no tied ranks, a computational shortcut exists:
d = difference in ranks for each pair
Only valid when no tied ranks exist
Software handles ties using rank averages
When ties are present, apply the general Pearson formula to the ranked data instead of this shortcut. See Spearman rank correlation.
Regression Formulas
Simple Linear Regression
b1 = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)²
b0 = ȳ − b1x̄
ŷ = predicted value; x = predictor
The slope b1 gives the expected change in the outcome y for each one-unit increase in the predictor x. The intercept b0 is the expected value of y when x = 0 (which may not always be a meaningful interpretation). See simple linear regression and the regression calculator.
R-Squared
R² is the proportion of the total variability in y that is associated with the fitted linear model. An R² of 0.75 means 75% of the variability in y is accounted for by x in the model. R² does not prove causation, and a high R² does not guarantee the model is correctly specified. See R-squared.
Multiple Linear Regression
See multiple linear regression. Residuals (observed minus predicted: e = y − ŷ) are the basis for checking model assumptions. See residuals.
Logistic Regression
p = probability of outcome
p/(1−p) = odds
Odds Ratio = e^β
Each coefficient β represents the change in the log odds of the outcome per unit increase in the predictor. Exponentiating gives the odds ratio (OR = e^β). The odds ratio is not the same as the relative risk — they converge only when the outcome is rare. See logistic regression.
Risk, Odds, and Diagnostic Formulas
Risk and Relative Risk
Odds and Odds Ratio
Group 1: 40 events in 100. Group 0: 20 events in 100.
Risks: Risk₁ = 40/100 = 0.40; Risk₀ = 20/100 = 0.20
RR: 0.40 / 0.20 = 2.0
Odds₁: 0.40/0.60 = 0.667; Odds₀: 0.20/0.80 = 0.25
OR: 0.667 / 0.25 = 2.667
RR = 2.0; OR = 2.667. They differ because the outcome is not rare. Never interpret OR as if it were RR when event rates are substantial. See relative risk calculator and odds ratio calculator.
Diagnostic Test Formulas
| Disease + | Disease − | |
|---|---|---|
| Test + | TP | FP |
| Test − | FN | TN |
Sensitivity and specificity are properties of the test. PPV and NPV depend on disease prevalence — the same test will have different PPV and NPV in a high-prevalence versus low-prevalence population. See sensitivity and specificity.
Effect Size Formulas
Effect sizes quantify the practical magnitude of a result, independently of sample size. A statistically significant result at large n may have a trivially small effect. Always report effect sizes alongside p-values. Conventional cutoffs for small/medium/large effects are rough guidelines — the appropriate benchmark depends on the context of the research. See effect size.
Cohen's d uses a pooled standard deviation as the denominator in the two-group case; the specific pooling formula should be stated. Partial eta squared is preferred over eta squared for multi-factor ANOVA. See Cohen's d and the effect size calculator.
Formula Selection Guide
Selecting the right formula requires knowing what you want to calculate, what type of data you have, how many groups are involved, and whether observations are independent or paired. The guide below is a starting point — always verify that the method's assumptions fit your data before proceeding. A fuller decision tool is at statistical test selector.
What are you trying to calculate?
20 Common Formula Mistakes
Using n instead of n−1 for sample variance
The denominator n−1 is needed for the unbiased sample variance estimator. Using n produces a biased result that systematically underestimates σ².
Confusing variance and standard deviation
Variance is in squared units; standard deviation is in the original units. They are not interchangeable when describing spread.
Using standard deviation where standard error is needed
SE = s/√n and shrinks with sample size. SD describes the spread of individual observations, not the precision of a mean estimate.
Applying population formulas to sample data without justification
Using σ or μ when you only have sample data gives misleading results unless you genuinely have the full population.
Forgetting to square deviations when computing variance
Deviations always sum to zero, so the unsquared sum carries no information about spread. The formula requires squaring before summing.
Treating independent and mutually exclusive as the same
They are different properties. Mutually exclusive events cannot both occur; independent events can both occur but do not influence each other.
Using the addition rule without subtracting the intersection
P(A∪B) = P(A)+P(B) only works when the events are mutually exclusive. Otherwise subtract P(A∩B).
Confusing risk and odds
Risk is events/total at risk; odds are p/(1−p). They differ whenever p is not near zero.
Interpreting the odds ratio as if it were a relative risk
OR and RR converge only when the outcome is rare. At higher event rates, OR is further from 1 than RR.
Applying the Spearman no-ties shortcut when ties exist
The formula ρ = 1−6Σd²/[n(n²−1)] is only valid without tied ranks. Use the Pearson formula on ranks instead.
Using an inappropriate confidence interval method
The Wald proportion interval can perform poorly near p̂ = 0 or 1 or in small samples. Consider Wilson or Clopper-Pearson intervals.
Assuming every confidence interval uses z critical values
When σ is unknown (the usual case for means), the t-distribution is used. The critical value depends on the confidence level, the distribution, and the degrees of freedom.
Misinterpreting p-values
A p-value is not the probability that H₀ is true, nor the probability the result occurred by chance. It is the probability of the observed data or more extreme data, given that H₀ is true.
Treating statistical significance as practical significance
A p-value below 0.05 does not mean the effect is large or important. Report effect sizes alongside p-values.
Assuming correlation proves causation
Correlation measures linear association, not causation. A confounding variable or reverse causation can produce correlation without a direct causal link.
Applying formulas without checking assumptions
Every statistical method has conditions (independence, distribution, sample size, variable type). Violations can invalidate the result.
Rounding too early in calculations
Round intermediate results and rounding errors accumulate. Carry full precision through the calculation and round only at the final step.
Mixing incompatible units
Adding values in different units (seconds and minutes, kilograms and pounds) produces meaningless results.
Confusing sample statistics with population parameters
x̄ estimates μ; s estimates σ; p̂ estimates p. Using a sample statistic as if it were the true parameter ignores sampling variability.
Ignoring paired or repeated observations
Applying an unpaired test to paired data ignores within-pair correlation and can produce incorrect conclusions. See paired t-test.