Reference
Methods and formulas
Every method used in the lessons and the lab: notation, formulas with each symbol explained, when to use it, its assumptions, how to interpret it and the mistakes to avoid.
96 of 96 entries
Notation
Describing data
- Arithmetic meanThe mean is the sum of the values divided by their number — the balance point of the data, sensitive to every value including outliers.
- Weighted and geometric meansA weighted mean gives some values more influence than others; a geometric mean averages multiplicative change such as growth rates.
- Median and modeThe median is the middle value of the sorted data (robust to outliers); the mode is the most frequent value (the only centre for nominal data).
- Variance and standard deviationThe standard deviation measures the typical distance of values from their mean; the sample version divides the sum of squares by n − 1.
- Quantiles, percentiles and quartilesThe p-th quantile is a value with about a proportion p of the data below it; software differs in how it interpolates, and Statistics Quest uses Hyndman–Fan type 7 by default.
- Five-number summary, box plots and outlier fencesMinimum, Q1, median, Q3 and maximum summarise a distribution; Tukey's fences at 1.5·IQR beyond the quartiles flag potential outliers.
- z-scores (standardised values)A z-score says how many standard deviations a value lies above or below the mean, which allows comparison across different scales.
- Coefficient of variationThe coefficient of variation is the standard deviation divided by the mean — spread relative to size, without units.
- Skewness and excess kurtosisSkewness measures asymmetry and excess kurtosis measures tail heaviness relative to the normal distribution (normal = 0 for both).
- Robust measures: MAD, trimmed and winsorized meansRobust summaries such as the median absolute deviation and the trimmed mean change little when a few values are extreme or wrong.
- Grouped data estimatesWhen only class counts are available, the mean, SD and median are estimated by treating each class as concentrated at its midpoint and interpolating within the median class.
Probability
- Probability rulesThe complement, addition and multiplication rules combine probabilities of events; all follow from probabilities being between 0 and 1 and summing to 1 over the sample space.
- Conditional probability and independenceP(A | B) is the probability of A among the cases where B happened; A and B are independent when knowing B does not change the probability of A.
- Bayes' theorem and diagnostic testsBayes' theorem reverses a conditional probability, combining a base rate with the accuracy of evidence — essential for interpreting screening results.
- Counting: permutations and combinationsPermutations count ordered arrangements and combinations count unordered selections; with equally likely outcomes, probability = favourable count ÷ total count.
- Expected value and variance of a random variableThe expected value is the long-run average of a random quantity and its variance the long-run average squared distance from that mean.
Distributions
- Random variables: pmf, pdf, cdf, sf and quantilesA random variable assigns a number to each outcome; its distribution is described by a pmf or pdf, a cdf, a survival function and a quantile function.
- Bernoulli and binomial distributionsThe binomial distribution counts successes in a fixed number n of independent trials that each succeed with the same probability p.
- Geometric distributionThe geometric distribution counts the number of independent trials up to and including the first success.
- Hypergeometric distributionThe hypergeometric distribution counts successes in a sample drawn without replacement from a finite population with a known number of successes.
- Poisson distributionThe Poisson distribution models the number of events in a fixed interval when events occur independently at a constant average rate.
- Continuous uniform distributionThe continuous uniform distribution gives every value in an interval [a, b] the same density.
- Exponential distributionThe exponential distribution models the waiting time until the next event when events occur at a constant rate.
- Normal distributionThe normal distribution is the symmetric bell-shaped curve fully described by its mean μ and standard deviation σ.
- Student's t distributionThe t distribution is the symmetric, heavier-tailed sampling distribution of a standardised mean when σ is estimated by the sample SD.
- Chi-square distributionThe chi-square distribution with k degrees of freedom is the distribution of a sum of k squared independent standard normals; it is right-skewed and non-negative.
- F distributionThe F distribution is the distribution of a ratio of two independent chi-square variables, each divided by its degrees of freedom; it is used for comparing variances and in ANOVA and regression.
Sampling
- Sampling distributions and standard errorA sampling distribution describes how a statistic varies from sample to sample; its standard deviation is the standard error.
- Central limit theoremFor large enough samples, the sampling distribution of the mean is approximately normal with mean μ and standard error σ/√n, whatever the shape of the population.
- Finite population correction (FPC)When sampling without replacement a sizeable fraction of a finite population, the standard error is multiplied by the finite population correction √((N − n)/(N − 1)).
Estimation
- Confidence intervals: meaning and interpretationA confidence interval is an estimate ± margin of error produced by a procedure that captures the true parameter in a stated proportion of repeated samples.
- z interval for a mean (σ known)When the population standard deviation σ is known, the interval for μ is x̄ ± z·σ/√n.
- t interval for a mean (σ unknown)With σ estimated by the sample SD, the interval for μ is x̄ ± t(n − 1)·s/√n.
- Confidence interval for a proportion (Wald, Wilson, Clopper–Pearson)Intervals for a population proportion; the Wilson score interval is recommended, the Wald interval is simple but unreliable for small n or p near 0 or 1, and Clopper–Pearson is exact and conservative.
- Confidence intervals for a difference in means (Welch, pooled, paired)Intervals for μ₁ − μ₂ from independent samples (Welch by default, pooled when variances are assumed equal) or for the mean difference of paired data.
- Confidence interval for a difference in proportionsInterval for p₁ − p₂ from two independent samples, using the unpooled (Wald) standard error or Newcombe's hybrid score method.
- Sample size for a margin of errorChoose n so that a confidence interval for a mean or proportion has at most a desired margin of error E, rounding up and optionally applying the finite population correction.
Hypothesis testing
- Hypothesis testing: the frameworkA hypothesis test measures how surprising the data would be if a stated null hypothesis about a parameter were true, and turns that into a decision at a pre-chosen significance level.
- p-valueThe p-value is the probability, computed assuming the null hypothesis and the test's model are true, of getting a test statistic at least as extreme as the one observed.
- Type I and Type II errors, significance level and powerA test can wrongly reject a true null (Type I, probability α) or miss a real effect (Type II, probability β); power = 1 − β is the chance of detecting an effect of a given size.
- Effect sizesEffect sizes measure how large a difference or association is, in raw or standardised units, independently of the sample size.
- One-sample t-testTests whether a population mean equals a stated value, using the sample mean, the sample SD and the t distribution with n − 1 degrees of freedom.
- Two-sample t-test (Welch and pooled)Compares the means of two independent groups; Welch's version (the engine default) does not assume equal variances, the pooled version does.
- Paired t-testTests the mean of within-pair differences (before/after, matched pairs) with a one-sample t-test on the differences.
- Tests for one proportion (z-test and exact binomial test)Tests whether a population proportion equals p₀, by the score z-test (large samples) or the exact binomial test (any size).
- Two-proportion z-testCompares two independent proportions, using the pooled proportion for the test and the unpooled standard error for the confidence interval.
- One-way ANOVATests whether k ≥ 2 group means are all equal by comparing variation between group means with variation within groups.
- Welch's ANOVAA one-way ANOVA that does not assume equal group variances, weighting each group by n/s².
- Tukey HSD (post-hoc pairwise comparisons)Compares every pair of group means after an ANOVA while controlling the family-wise error rate, using the studentized range distribution.
- Multiple-comparison adjustments (Bonferroni, Holm, Hochberg, Benjamini–Hochberg)Adjust p-values when running several tests so that either the family-wise error rate (FWER) or the false discovery rate (FDR) stays at α.
- Levene's and Brown–Forsythe tests for equal variancesTest whether several groups have equal population variances by running a one-way ANOVA on absolute deviations from each group's mean (Levene) or median (Brown–Forsythe).
- Shapiro–Wilk normality testTests whether a sample is consistent with a normal population by measuring how well the ordered data line up with expected normal order statistics.
- Mann–Whitney U test (Wilcoxon rank-sum)A rank-based test comparing two independent groups; it tests whether values in one group tend to be larger than in the other.
- Wilcoxon signed-rank testA rank-based test for paired data (or one sample against a hypothesised median) using the ranks of the absolute differences and their signs.
- Kruskal–Wallis testA rank-based alternative to one-way ANOVA that tests whether k independent groups come from the same distribution.
- Choosing a test: decision guideMatch the question, the outcome type and the study design to an appropriate method, then check its assumptions.
Correlation and regression
- Covariance and Pearson correlationCovariance and Pearson's r measure how strongly two quantitative variables move together along a straight line.
- Rank correlation: Spearman and KendallSpearman's ρ and Kendall's τ-b measure monotone association using ranks, so they resist outliers and do not require a straight line.
- Simple linear regression (least squares)The least-squares line ŷ = b₀ + b₁x predicts a quantitative response from one predictor by minimising the sum of squared residuals.
- Multiple linear regressionMultiple regression models the mean response as a linear combination of several predictors, each coefficient describing a change with the others held fixed.
- R², adjusted R² and residual standard errorR² is the share of the response's variation explained by the model, adjusted R² penalises extra predictors, and the residual standard error is the typical size of a residual.
- Inference for regression coefficientsEach coefficient has a standard error, a t-test of β = 0 and a confidence interval on n − p degrees of freedom.
- Confidence vs prediction intervals in regressionA confidence interval estimates the mean response at x₀; a prediction interval covers a single new observation and is always wider.
- Residual diagnosticsResidual plots and standardised residuals check the linearity, independence, normality and equal-variance conditions behind regression inference.
- Leverage, outliers and Cook's distanceLeverage measures how unusual a point's predictor values are, and Cook's distance measures how much the fitted model changes when the point is removed.
- Multicollinearity and the variance inflation factorWhen predictors are strongly correlated with each other their coefficients become unstable, and the VIF measures how much each coefficient's variance is inflated.
- Transformations in regressionTaking logs (or other transformations) of y or x can straighten curved relationships and stabilise variance, and changes how coefficients are read.
- Logistic regression and odds ratiosLogistic regression models the log-odds of a binary outcome as a linear function of predictors, so each exponentiated coefficient is an odds ratio.
- Confusion matrix and classification metricsA confusion matrix counts correct and incorrect predictions at a threshold, and metrics such as precision, recall and specificity summarise different kinds of error.
- ROC curve and AUCThe ROC curve plots the true positive rate against the false positive rate over all thresholds, and the AUC is the probability that a random positive outscores a random negative.
Categorical data and ANOVA
- Chi-square goodness-of-fit testTests whether the counts in k categories are consistent with a stated set of proportions.
- Chi-square test of independence (and homogeneity)Tests whether two categorical variables are associated in an r × c contingency table by comparing observed counts with those expected under independence.
- Fisher's exact testAn exact test of association in a 2 × 2 table that conditions on both margins, valid for any sample size.
Experiments and A/B testing
- Analysing an A/B test on conversion ratesEstimate each variant's conversion rate with a Wilson interval, then estimate and test the difference and report the relative lift with its uncertainty.
- Sample size and minimum detectable effect for an A/B testThe number of units per arm needed to detect a given difference in conversion rates with chosen α and power, and conversely the smallest effect a fixed sample can detect.
- Peeking and sequential testingChecking a fixed-sample test repeatedly and stopping at the first significant result inflates the false-positive rate well above α; sequential designs spend α deliberately across planned looks.
- Guardrail metricsMetrics that must not get meaningfully worse (errors, latency, complaints, refunds) — judged by whether the interval rules out harm larger than a pre-agreed tolerance, not by a non-significant p-value.
- Sample ratio mismatch (SRM)A chi-square goodness-of-fit check that the numbers of units assigned to each variant match the planned split; a mismatch signals a broken assignment or logging pipeline.
Time series and forecasting
- Moving averagesAverages over a sliding window of consecutive observations that smooth out short-term noise; trailing windows use only the past, centred windows estimate the trend.
- Simple exponential smoothing (SES)A forecast for series without trend or seasonality: a weighted average of past observations with weights that decay geometrically, controlled by the smoothing parameter α.
- Holt's linear trend and Holt–Winters seasonal methodsExponential smoothing extended with a smoothed trend (Holt) and seasonal terms (Holt–Winters, additive or multiplicative), using the error-correction recursions of FPP3.
- Forecast accuracy: MAE, RMSE, MAPE and MASESummaries of forecast errors on data the model did not see: MAE and RMSE in the series' units, MAPE in percent, and MASE scaled by the in-sample naive method.
- Autocorrelation (ACF) and partial autocorrelation (PACF)The correlation of a series with its own past at each lag (ACF), and the same after removing the effect of shorter lags (PACF), used to detect dependence, seasonality and AR order.
- Classical decompositionSplitting a seasonal series into trend (centred moving average), a fixed seasonal pattern and a remainder, in additive or multiplicative form.
- Stationarity and autoregressive (AR) modelsAn AR(p) model predicts a stationary series from a linear combination of its own last p values; differencing first turns many trending series into stationary ones.
Resampling
- The bootstrap: standard errors and intervalsResample the data with replacement many times, recompute the statistic each time, and use the spread of those replicates to estimate its standard error and a confidence interval (percentile or BCa).
- Permutation testsTest whether a group label matters by recomputing the statistic for every (or many random) reshuffling of the labels; the p-value is the share of shuffles at least as extreme as the observed one.
Bayesian methods
- Beta–binomial updatingWith a Beta(a, b) prior for a success probability and s successes and f failures, the posterior is Beta(a + s, b + f) — the prior acts like a + b earlier observations.
- Credible intervalsAn interval containing a stated posterior probability of the parameter; unlike a confidence interval it can be read directly as a probability statement about the parameter, given the model and prior.
- Bayesian A/B analysis: P(B > A) and expected lossWith independent Beta posteriors for two conversion rates, compute the probability that B's rate exceeds A's and the expected loss of choosing each variant.
Multivariate and classification
Quality and process control
- X̄–R control chartsPaired charts of subgroup means and subgroup ranges with 3-sigma limits from the within-subgroup variation, used to tell routine process variation from special causes.
- p and c control chartsControl charts for count data: the p chart tracks the proportion defective in samples (binomial), the c chart the number of defects per constant inspection unit (Poisson).
- Western Electric run rulesFour pattern rules that flag non-random behaviour on a Shewhart chart even when no point crosses the 3-sigma limits.
- Process capability: Cp and CpkIndices comparing the specification width with the process's natural spread (Cp) and accounting for how well the process is centred (Cpk).