Formula cheat-sheet
Describing data
Sample mean
\[\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i\]
Center / balance point of a numeric column; sensitive to outliers.
Sample variance
\[s^2 = \frac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})^2\]
Average squared distance from the mean; divide by n-1 for a sample.
Sample standard deviation
\[s = \sqrt{s^2}\]
Spread back in the original units, so it is directly readable.
z-score (standardize)
\[z = \frac{x - \bar{x}}{s}\]
How many SDs a value sits from the mean; makes values comparable.
Interquartile range
\[\text{IQR} = Q_3 - Q_1\]
Spread of the middle 50%; robust to outliers (basis of boxplots).
Outlier fences
\[[\,Q_1 - 1.5\,\text{IQR},\; Q_3 + 1.5\,\text{IQR}\,]\]
Points outside these whiskers are flagged as potential outliers.
Skewness
\[\text{skew} = \frac{1}{n}\sum_{i=1}^{n}\left(\frac{x_i - \bar{x}}{\sigma}\right)^3\]
Sign tells direction of the longer tail (uses population SD, divide by n).
Probability
Empirical probability
\[P(A) = \frac{\text{number of times } A \text{ happens}}{\text{total number of trials}}\]
Estimate a probability as a long-run fraction (the mean of a 0/1 mask).
Complement rule
\[P(A^{c}) = 1 - P(A)\]
Chance an event does NOT happen; often easier than P(A) directly.
Addition rule
\[P(A \cup B) = P(A) + P(B) - P(A \cap B)\]
Probability of A or B; subtract the overlap so it is not double-counted.
Conditional probability
\[P(A \mid B) = \frac{P(A \cap B)}{P(B)}\]
Probability of A given B occurred; restricts attention to the B world.
Multiplication rule
\[P(A \cap B) = P(A \mid B)\,P(B)\]
Chain rule for joint probability; for independent events P(A)P(B).
Bayes' theorem
\[P(A \mid B) = \frac{P(B \mid A)\,P(A)}{P(B)}\]
Flip a conditional probability around when you know the reverse direction.
Combinations (n choose k)
\[\binom{n}{k} = \frac{n!}{k!\,(n-k)!}\]
Number of ways to choose k items from n when order does not matter.
Random variables
Expected value (discrete)
\[E(X) = \mu = \sum_{x} x\,P(X = x)\]
Long-run average outcome, weighting each value by its probability.
Variance of X
\[\operatorname{Var}(X) = \sigma^2 = \sum_{x}(x-\mu)^2\,P(X = x)\]
Spread of a random variable around its mean; SD is the square root.
Linear transform
\[E(aX + b) = a\,E(X) + b, \qquad \operatorname{Var}(aX + b) = a^2\,\operatorname{Var}(X)\]
Rescaling rules; the constant b shifts the mean but not the spread.
Distributions
Binomial PMF
\[P(X = k) = \binom{n}{k}\,p^{k}\,(1-p)^{\,n-k}\]
Chance of k successes in n independent trials each with probability p.
Binomial mean & variance
\[\text{mean} = np, \qquad \text{variance} = np(1-p)\]
Quick summary numbers for a count of successes.
Poisson PMF
\[P(X = k) = \frac{e^{-\lambda}\,\lambda^{k}}{k!}\]
Counts of rare events in a fixed window; one parameter lambda.
Poisson mean & variance
\[\text{mean} = \lambda = \text{variance}\]
Defining feature: mean equals variance (a Poisson diagnostic).
Normal PDF
\[f(x) = \frac{1}{\sigma\sqrt{2\pi}}\; e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}\]
Bell curve fully described by mu and sigma; basis of the empirical rule.
Empirical (68-95-99.7) rule
\[P(\mu - k\sigma \le X \le \mu + k\sigma) \approx 68\%,\,95\%,\,99.7\% \;\text{for } k=1,2,3\]
Fast mental check of how much normal data lies within k SDs.
Sampling & the CLT
Standard error of the mean
\[\text{SE}(\bar{x}) = \frac{\sigma}{\sqrt{n}}\]
Spread of the sample mean from sample to sample (true sigma version).
Estimated standard error
\[\widehat{\text{SE}}(\bar{x}) = \frac{s}{\sqrt{n}}\]
What you use in practice when sigma is unknown (plug in s).
Central Limit Theorem
\[\bar{x} \;\approx\; N\!\left(\mu,\ \frac{\sigma}{\sqrt{n}}\right)\]
Sample means become normal as n grows, even from a skewed population.
SE of a proportion
\[\text{SE}(\hat{p}) = \sqrt{\dfrac{\hat{p}\,(1-\hat{p})}{n}}\]
Wobble of a sample proportion; largest at p-hat = 0.5.
Confidence intervals
CI for a mean (t)
\[\bar{x} \;\pm\; t^{*}\,\frac{s}{\sqrt{n}}\]
Plausible range for mu when sigma is unknown; df = n-1.
CI for a mean (z)
\[\bar{x} \;\pm\; z^{*}\,\frac{\sigma}{\sqrt{n}}\]
Use when sigma is known or n is large; z* = 1.96 for 95%.
CI for a proportion
\[\hat{p} \;\pm\; z^{*}\sqrt{\dfrac{\hat{p}\,(1-\hat{p})}{n}}\]
Range for the true proportion p from a single sample.
Margin of error
\[\text{ME} = z^{*}\cdot \text{SE}\]
Half-width of the interval; shrinks like 1/sqrt(n).
Hypothesis tests
One-sample t-test
\[t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}, \qquad df = n-1\]
Compare one group's mean to a target value mu_0.
Welch two-sample t
\[t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}}}\]
Compare two independent group means without assuming equal variance.
Paired t-test
\[t = \frac{\bar{d}}{s_d/\sqrt{n}}\]
Test the mean of within-pair differences; use when data are matched.
One-proportion z-test
\[z = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}}\]
Test a sample proportion against a hypothesized value p_0.
Chi-square statistic
\[\chi^2 = \sum_{\text{categories}} \frac{(O - E)^2}{E}\]
Total 'surprise' comparing observed counts O to expected counts E.
ANOVA F-statistic
\[F = \frac{MS_{\text{between}}}{MS_{\text{within}}}\]
Compare 3+ group means; F well above 1 signals real differences.
ANOVA mean squares
\[MS_{\text{between}} = \frac{SS_{\text{between}}}{k-1}, \qquad MS_{\text{within}} = \frac{SS_{\text{within}}}{N-k}\]
Sums of squares divided by their degrees of freedom feed the F ratio.
Regression
Correlation coefficient
\[r = \frac{1}{n-1}\sum_{i=1}^{n} \left(\frac{x_i-\bar{x}}{s_x}\right)\left(\frac{y_i-\bar{y}}{s_y}\right)\]
Strength/direction of a linear relationship, between -1 and +1.
Least-squares line
\[\hat{y} = b_0 + b_1 x\]
Predicted y; the line minimizing the sum of squared vertical misses.
Slope & intercept
\[b_1 = r\,\frac{s_y}{s_x}, \qquad b_0 = \bar{y} - b_1\,\bar{x}\]
Slope is correlation rescaled to real units; line passes through (x-bar, y-bar).
Residual
\[e_i = y_i - \hat{y}_i\]
Actual minus predicted; inspect residual plots to check assumptions.
Coefficient of determination
\[R^2 = r^2\]
Share of y's variation explained by the line (simple regression).
SE & test of the slope
\[\text{SE}(b_1) = \frac{s_e}{\sqrt{\sum (x_i-\bar{x})^2}}, \qquad t = \frac{b_1 - 0}{\text{SE}(b_1)},\; df = n-2\]
Tests H0: beta_1 = 0, i.e. whether x has any linear effect on y.