Markdown Editor

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

AkademikLengkapNIST/SEMATECH e-Handbook of Statistical Methods; Welch (1947); Wilson (1927); Nelder and Wedderburn (1972); Cohen (1988); GAISE College Report (ASA 2016, name)statsformulasheetmath

Cara menggunakan: 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.

Pratinjau

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

FieldValue
Course or project[STAT 201 Inferential Statistics, Lakemoor University (fictional)]
Learner or analyst[Your name]
Data setFictional check data typed in the code below (exam scores, study hours, library counts)
Software and versionsR 4.5.1 (base stats); Python 3.14 with numpy 2.5.4, scipy 1.18.1, statsmodels 0.15.0
DateYYYY-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

SymbolMeaningSymbolMeaning
nnsample sizeNNpopulation size or total count
xˉ\bar{x}sample meanμ\mupopulation mean
sssample standard deviationσ\sigmapopulation standard deviation
p^\hat{p}sample proportionpppopulation proportion
SEstandard error of an estimatedfdegrees of freedom
α\alphasignificance level (0.05 here)1−β1-\betapower
zqz_{q}standard normal quantile with area qq belowtq, dft_{q,\,df}t quantile with area qq below
H0H_0, H1H_1null and alternative hypotheseskknumber of groups
OO, EEobserved and expected countsrrPearson correlation
b0b_0, b1b_1regression intercept and slopeR2R^2proportion 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 n−1n-1 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.

xˉ=1n∑i=1nxis2=1n−1∑i=1n(xi−xˉ)2s=s2\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i \qquad s^2 = \frac{1}{n-1}\sum_{i=1}^{n} (x_i-\bar{x})^2 \qquad s = \sqrt{s^2}
zi=xi−xˉsIQR=Q3−Q1outlier fences: Q1−1.5 IQR, Q3+1.5 IQRz_i = \frac{x_i - \bar{x}}{s} \qquad \text{IQR} = Q_3 - Q_1 \qquad \text{outlier fences: } Q_1 - 1.5\,\text{IQR},\ Q_3 + 1.5\,\text{IQR}
  • Use when: mean and SD for roughly symmetric data; median and IQR for skewed data or data with outliers.
  • Common slip: dividing by nn instead of n−1n-1 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 default linear method; 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.

P(A∪B)=P(A)+P(B)−P(A∩B)P(A∩B)=P(A) P(B∣A)P(A \cup B) = P(A) + P(B) - P(A \cap B) \qquad P(A \cap B) = P(A)\,P(B \mid A)
P(A∣B)=P(A∩B)P(B)independence: P(A∩B)=P(A) P(B)P(A \mid B) = \frac{P(A \cap B)}{P(B)} \qquad \text{independence: } P(A \cap B) = P(A)\,P(B)

Bayes' theorem turns a probability of the evidence given a hypothesis into a probability of the hypothesis given the evidence:

P(H∣E)=P(E∣H) P(H)P(E∣H) P(H)+P(E∣¬H) P(¬H)P(H \mid E) = \frac{P(E \mid H)\,P(H)}{P(E \mid H)\,P(H) + P(E \mid \neg H)\,P(\neg H)}
  • Use when: screening tests, diagnostic questions, "given that" wording, updating a belief with new evidence.
  • Common slip: confusing P(E∣H)P(E \mid H) with P(H∣E)P(H \mid E) (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 AA and BB cannot both happen and both have positive probability, they are strongly dependent.

Counting: n!n! orderings of nn items; (nk)=n!k! (n−k)!\binom{n}{k} = \dfrac{n!}{k!\,(n-k)!} ways to choose kk of nn when order does not matter.

3. Distributions

The binomial counts successes in nn independent trials with the same success probability pp. The Poisson counts events in a fixed interval when they occur independently at a constant rate λ\lambda. The normal is the bell curve that sampling distributions of means approach.

P(X=k)=(nk)pk(1−p)n−k,E(X)=np,Var⁡(X)=np(1−p)P(X=k) = \binom{n}{k} p^k (1-p)^{n-k}, \quad E(X)=np, \quad \operatorname{Var}(X)=np(1-p)
P(X=k)=e−λλkk!,E(X)=Var⁡(X)=λP(X=k) = \frac{e^{-\lambda}\lambda^k}{k!}, \quad E(X)=\operatorname{Var}(X)=\lambda
f(x)=1σ2πexp⁡ ⁣(−(x−μ)22σ2),Z=X−μσ∼N(0,1)f(x) = \frac{1}{\sigma\sqrt{2\pi}}\exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right), \quad Z = \frac{X-\mu}{\sigma} \sim N(0,1)
  • 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 pp 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 z0.975=1.960z_{0.975} = 1.960.

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 nn even when the data are not, unless they are very skewed or have extreme outliers.

EstimateStandard errorNotes
Mean xˉ\bar{x}s/ns/\sqrt{n}uses sample SD ss
Proportion p^\hat{p}p^(1−p^)/n\sqrt{\hat{p}(1-\hat{p})/n}use p0p_0 in place of p^\hat{p} for a test
Difference of means (Welch)s12/n1+s22/n2\sqrt{s_1^2/n_1 + s_2^2/n_2}default for two independent groups
Difference of means (pooled)sp1/n1+1/n2s_p\sqrt{1/n_1 + 1/n_2}assumes equal variances
Mean of paired differencessd/ns_d/\sqrt{n}nn = number of pairs
Difference of proportions (CI)p^1(1−p^1)/n1+p^2(1−p^2)/n2\sqrt{\hat{p}_1(1-\hat{p}_1)/n_1 + \hat{p}_2(1-\hat{p}_2)/n_2}unpooled
Regression slope b1b_1se/Sxxs_e/\sqrt{S_{xx}}ses_e = residual SE
sp=(n1−1)s12+(n2−1)s22n1+n2−2s_p = \sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}}
  • Use when: any time you build a CI or a test statistic.
  • Common slip: the SE shrinks with n\sqrt{n}, not with nn: 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.

xˉ±t0.975, n−1 sn(xˉ1−xˉ2)±t0.975, νs12n1+s22n2\bar{x} \pm t_{0.975,\,n-1}\,\frac{s}{\sqrt{n}} \qquad (\bar{x}_1-\bar{x}_2) \pm t_{0.975,\,\nu}\sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}}
Wald: p^±z0.975p^(1−p^)nWilson: p^+z22n±zp^(1−p^)n+z24n21+z2n\text{Wald: } \hat{p} \pm z_{0.975}\sqrt{\frac{\hat{p}(1-\hat{p})}{n}} \qquad \text{Wilson: } \frac{\hat{p} + \frac{z^2}{2n} \pm z\sqrt{\frac{\hat{p}(1-\hat{p})}{n} + \frac{z^2}{4n^2}}}{1+\frac{z^2}{n}}
Correlation (Fisher z): tanh⁡ ⁣(artanh⁡(r)±z0.975n−3)\text{Correlation (Fisher } z\text{): } \tanh\!\left(\operatorname{artanh}(r) \pm \frac{z_{0.975}}{\sqrt{n-3}}\right)
  • 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 μ\mu 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 zz instead of tt with small samples; the Wald interval for proportions near 0 or 1 or small nn (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 H0H_0, of a statistic at least as extreme as the one observed.

One-sample z and t:

z=xˉ−μ0σ/nt=xˉ−μ0s/n,df=n−1z = \frac{\bar{x}-\mu_0}{\sigma/\sqrt{n}} \qquad t = \frac{\bar{x}-\mu_0}{s/\sqrt{n}},\quad df = n-1

Two independent groups: Welch (default) and pooled:

tW=xˉ1−xˉ2s12/n1+s22/n2ν=(s12/n1+s22/n2)2(s12/n1)2n1−1+(s22/n2)2n2−1t_W = \frac{\bar{x}_1-\bar{x}_2}{\sqrt{s_1^2/n_1 + s_2^2/n_2}} \qquad \nu = \frac{\left(s_1^2/n_1 + s_2^2/n_2\right)^2}{\dfrac{(s_1^2/n_1)^2}{n_1-1} + \dfrac{(s_2^2/n_2)^2}{n_2-1}}
tpooled=xˉ1−xˉ2sp1/n1+1/n2,df=n1+n2−2t_{\text{pooled}} = \frac{\bar{x}_1-\bar{x}_2}{s_p\sqrt{1/n_1+1/n_2}},\quad df = n_1+n_2-2

Paired: compute differences did_i first, then a one-sample t on them.

t=dˉsd/n,df=n−1t = \frac{\bar{d}}{s_d/\sqrt{n}},\quad df = n-1

Proportions:

z=p^−p0p0(1−p0)/nz=p^1−p^2pˉ(1−pˉ)(1n1+1n2),pˉ=x1+x2n1+n2z = \frac{\hat{p}-p_0}{\sqrt{p_0(1-p_0)/n}} \qquad z = \frac{\hat{p}_1-\hat{p}_2}{\sqrt{\bar{p}(1-\bar{p})\left(\frac{1}{n_1}+\frac{1}{n_2}\right)}},\quad \bar{p} = \frac{x_1+x_2}{n_1+n_2}

Chi-square (goodness of fit and independence):

χ2=∑(O−E)2EEij=(rowi total)(columnj total)N,df=(r−1)(c−1)\chi^2 = \sum \frac{(O-E)^2}{E} \qquad E_{ij} = \frac{(\text{row}_i \text{ total})(\text{column}_j \text{ total})}{N},\quad df = (r-1)(c-1)

F for two variances: F=s12/s22F = s_1^2/s_2^2 with df=(n1−1, n2−1)df = (n_1-1,\ n_2-1).

  • Use when: t for means with unknown σ\sigma (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, while scipy.stats.ttest_ind() defaults to pooled (equal_var=True). Set equal_var=False in 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's chi2_contingency() does too, so both differ from the hand formula unless you set correct = 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.

SSB=∑j=1knj(xˉj−xˉ)2SSW=∑j=1k∑i=1nj(xij−xˉj)2SST=SSB+SSWSS_B = \sum_{j=1}^{k} n_j(\bar{x}_j-\bar{x})^2 \qquad SS_W = \sum_{j=1}^{k}\sum_{i=1}^{n_j}(x_{ij}-\bar{x}_j)^2 \qquad SS_T = SS_B + SS_W
SourceSSdfMSF
Between groupsSSBSS_Bk−1k-1MSB=SSB/(k−1)MS_B = SS_B/(k-1)MSB/MSWMS_B/MS_W
Within groups (error)SSWSS_WN−kN-kMSW=SSW/(N−k)MS_W = SS_W/(N-k)
TotalSSTSS_TN−1N-1
η2=SSBSSTω2=SSB−(k−1)MSWSST+MSW\eta^2 = \frac{SS_B}{SS_T} \qquad \omega^2 = \frac{SS_B - (k-1)MS_W}{SS_T + MS_W}
  • 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).

Sxx=∑(xi−xˉ)2Syy=∑(yi−yˉ)2Sxy=∑(xi−xˉ)(yi−yˉ)S_{xx} = \sum (x_i-\bar{x})^2 \quad S_{yy} = \sum (y_i-\bar{y})^2 \quad S_{xy} = \sum (x_i-\bar{x})(y_i-\bar{y})
r=SxySxxSyyb1=SxySxx=r sysxb0=yˉ−b1xˉr = \frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}} \qquad b_1 = \frac{S_{xy}}{S_{xx}} = r\,\frac{s_y}{s_x} \qquad b_0 = \bar{y} - b_1\bar{x}
se=SSEn−2SE(b1)=seSxxt=b1SE(b1), df=n−2R2=1−SSESyys_e = \sqrt{\frac{SSE}{n-2}} \qquad SE(b_1) = \frac{s_e}{\sqrt{S_{xx}}} \qquad t = \frac{b_1}{SE(b_1)},\ df=n-2 \qquad R^2 = 1-\frac{SSE}{S_{yy}}

Test for a correlation: t=r(n−2)/(1−r2)t = r\sqrt{(n-2)/(1-r^2)} with df=n−2df = n-2 (identical to the slope t-test in simple regression). Adjusted R2=1−(1−R2)n−1n−p−1R^2 = 1 - (1-R^2)\dfrac{n-1}{n-p-1} with pp predictors.

  • Use when: rr for describing a linear association; regression for predicting yy from xx and estimating the change in yy per unit of xx.
  • Common slip: in simple regression R2=r2R^2 = r^2, but this does not hold for multiple regression with one predictor's rr. 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 η=b0+b1x\eta = b_0 + b_1x to the mean of the outcome through a link function.

Logistic: logit⁡(p)=ln⁡p1−p=b0+b1xp=11+e−(b0+b1x)OR=eb1\text{Logistic: } \operatorname{logit}(p) = \ln\frac{p}{1-p} = b_0 + b_1x \qquad p = \frac{1}{1+e^{-(b_0+b_1x)}} \qquad \text{OR} = e^{b_1}
Poisson: ln⁡(μ)=b0+b1xμ=eb0+b1xrate ratio=eb1,offset: ln⁡(μ)=ln⁡(t)+b0+b1x\text{Poisson: } \ln(\mu) = b_0 + b_1x \qquad \mu = e^{b_0+b_1x} \qquad \text{rate ratio} = e^{b_1}, \quad \text{offset: } \ln(\mu) = \ln(t) + b_0 + b_1x
  • Use when: logistic for a binary outcome (passed or failed); Poisson for counts (loans per day).
  • Common slip: reading b1b_1 from logistic regression as a change in probability. It is a change in log odds; eb1e^{b_1} 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.

d=xˉ1−xˉ2spg=d(1−34(n1+n2)−9)dz=dˉsdd = \frac{\bar{x}_1-\bar{x}_2}{s_p} \qquad g = d\left(1-\frac{3}{4(n_1+n_2)-9}\right) \qquad d_z = \frac{\bar{d}}{s_d}
Crameˊr’s V=χ2N(min⁡(r,c)−1)ϕ=χ2/N (2×2)OR=adbc\text{Cramér's } V = \sqrt{\frac{\chi^2}{N(\min(r,c)-1)}} \qquad \phi = \sqrt{\chi^2/N}\ (2\times 2) \qquad \text{OR} = \frac{ad}{bc}
r from t: r=t2t2+dfpartial η2=SSeffectSSeffect+SSerrorr \text{ from } t: \ r = \sqrt{\frac{t^2}{t^2+df}} \qquad \text{partial } \eta^2 = \frac{SS_{\text{effect}}}{SS_{\text{effect}}+SS_{\text{error}}}
  • Use when: dd or gg for two means (prefer gg for small samples); dzd_z for paired designs; VV or ϕ\phi for contingency tables; η2\eta^2 or ω2\omega^2 for ANOVA (ω2\omega^2 is less biased); OR for 2 x 2 tables and logistic.
  • Common slip: comparing dzd_z (paired) with dd (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 H0H_0 when a specified effect is real. It rises with the effect size, the sample size and α\alpha, and falls with the variability.

nper group≈2 (z1−α/2+z1−β)2d2n≈z1−α/22 p(1−p)E2 (proportion with margin E)n_{\text{per group}} \approx \frac{2\,(z_{1-\alpha/2} + z_{1-\beta})^2}{d^2} \qquad n \approx \frac{z_{1-\alpha/2}^2\,p(1-p)}{E^2}\ \text{(proportion with margin } E\text{)}
  • 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 nn for t-tests (it gives 62.8 per group for d=0.5d = 0.5, 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 aa = 72, 85, 78, 90, 66, 81, 88, 75, 83, 79 and no-quiz section bb = 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 xx = 2, 4, 5, 3, 6, 8, 7, 9, 5, 10 and exam score yy = 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.
QuantityFormula usedInputsResult
Mean, SD of aaSection 1n=10n=10xˉ=79.7\bar{x}=79.7, s=7.364s=7.364
Median, IQR of aatype 7 quartiles80.0, 8.75
95% CI for mean of aaxˉ±t s/n\bar{x} \pm t\,s/\sqrt{n}SE = 2.329, t0.975,9t_{0.975,9} = 2.262[74.43, 84.97]
One-sample t vs 75Section 6t(9)=2.018t(9)=2.018, p=.074p=.074
Welch t, aa vs bbSection 6SE = 2.898, ν\nu = 16.59t(16.59)=3.002t(16.59)=3.002, p=.008p=.008, 95% CI [2.57, 14.83]
Pooled t, aa vs bbSection 6sp=6.481s_p=6.481t(18)=3.002t(18)=3.002, p=.008p=.008 (.0077)
Cohen's d, Hedges' gSection 10d=1.342d=1.342, g=1.286g=1.286
F for variancessa2/sb2s_a^2/s_b^254.23 / 29.78F(9,9)=1.82F(9,9)=1.82, p=.385p=.385
Paired t (after minus before)Section 6dˉ=3.5\bar{d}=3.5, sd=2.204s_d=2.204t(7)=4.492t(7)=4.492, p=.003p=.003, 95% CI [1.66, 5.34], dz=1.588d_z=1.588
One-proportion z, 32 of 40 vs 0.90Section 6SE = 0.0474z=−2.108z=-2.108, p=.035p=.035; exact binomial p=.057p=.057
Two-proportion z, 45/60 vs 36/60Section 6pˉ=0.675\bar{p}=0.675z=1.754z=1.754, p=.079p=.079
Chi-square 2 x 2, no correctionSection 6E = 24, 16, 24, 16χ2(1)=7.50\chi^2(1)=7.50, p=.006p=.006; with Yates 6.30, p=.012p=.012
Cramér's V (here ϕ\phi), ORSection 10V=0.306V=0.306, OR = 0.273
One-way ANOVASection 7SSB=213.3SS_B=213.3, SSW=100.0SS_W=100.0F(2,12)=12.80F(2,12)=12.80, p=.001p=.001, η2=0.681\eta^2=0.681, ω2=0.611\omega^2=0.611
CorrelationSection 8Sxx=60.9S_{xx}=60.9, Sxy=182.6S_{xy}=182.6, Syy=640.4S_{yy}=640.4r=0.925r=0.925, t(8)=6.866t(8)=6.866, p<.001p<.001, 95% CI [0.71, 0.98]
RegressionSection 8b1=2.998b_1=2.998, b0=54.91b_0=54.91, SE(b1)=0.437SE(b_1)=0.437, se=3.408s_e=3.408, R2=0.855R^2=0.855
Logistic, b0=−2b_0=-2, b1=0.5b_1=0.5Section 9x=4x=4, x=6x=6p=0.500p=0.500, p=0.731p=0.731, OR = 1.649
Poisson, b0=1.2b_0=1.2, b1=0.3b_1=0.3Section 9x=2x=2μ=6.05\mu=6.05, rate ratio 1.350
Power, d=0.5d=0.5, power 0.80Section 11approx. 62.8, exact 63.8, so 64 per group
Proportion, margin 0.05Section 11p=0.5p=0.5384.1, so 385
Bayes, prevalence 2%, sensitivity 95%, specificity 90%Section 2P(case∣+)=0.162P(\text{case} \mid +) = 0.162
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 1−3/(4(n1+n2)−9)1 - 3/(4(n_1+n_2)-9) equals 1−3/(4 df−1)1 - 3/(4\,df - 1) with df=n1+n2−2df = n_1+n_2-2, so both forms give g=1.286g = 1.286 here.

Worked examples with fading

Example A (fully worked): Welch t by hand. Quiz section aa: xˉ1=79.7\bar{x}_1 = 79.7, s12=54.23s_1^2 = 54.23, n1=10n_1 = 10. No-quiz section bb: xˉ2=71.0\bar{x}_2 = 71.0, s22=29.78s_2^2 = 29.78, n2=10n_2 = 10.

  1. Variance of each mean: 54.23/10=5.42354.23/10 = 5.423 and 29.78/10=2.97829.78/10 = 2.978.
  2. SE of the difference: 5.423+2.978=8.401=2.898\sqrt{5.423 + 2.978} = \sqrt{8.401} = 2.898.
  3. Statistic: t=(79.7−71.0)/2.898=3.002t = (79.7 - 71.0)/2.898 = 3.002.
  4. Welch df: ν=8.4012/(5.4232/9+2.9782/9)=70.58/4.253=16.59\nu = 8.401^2 / (5.423^2/9 + 2.978^2/9) = 70.58/4.253 = 16.59.
  5. Critical value t0.975, 16.59=2.114t_{0.975,\,16.59} = 2.114, so the 95% CI is 8.7±2.114×2.898=[2.57,14.83]8.7 \pm 2.114 \times 2.898 = [2.57, 14.83].
  6. 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: Sxx=60.9S_{xx} = 60.9, Sxy=182.6S_{xy} = 182.6, Syy=640.4S_{yy} = 640.4, xˉ=5.9\bar{x} = 5.9, yˉ=72.6\bar{y} = 72.6, n=10n = 10, SSE=92.90SSE = 92.90.

  1. Slope b1=Sxy/Sxx=182.6/60.9=b_1 = S_{xy}/S_{xx} = 182.6/60.9 = [ ].
  2. Intercept b0=yˉ−b1xˉ=72.6−b_0 = \bar{y} - b_1\bar{x} = 72.6 - [ ] ×5.9=\times 5.9 = [ ].
  3. R2=1−SSE/Syy=1−92.90/640.4=R^2 = 1 - SSE/S_{yy} = 1 - 92.90/640.4 = [ ].
  4. se=SSE/(n−2)=92.90/8=3.408s_e = \sqrt{SSE/(n-2)} = \sqrt{92.90/8} = 3.408, so SE(b1)=3.408/60.9=SE(b_1) = 3.408/\sqrt{60.9} = [ ].
  5. 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 p^\hat{p}, the SE under H0H_0, 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 moveCorrect move
Using the SD where the SE is neededSE = SD of the estimate, for a mean s/ns/\sqrt{n}
Dividing by nn for a sample variancedivide by n−1n-1
Using zz with n=8n = 8 and unknown σ\sigmause tt with df=n−1df = n-1
Treating paired data as independentcompute differences, then a one-sample t
Assuming R and Python give the same defaultWelch in R, pooled in scipy; Yates correction on 2 x 2 tables in both
Reading a logistic b1b_1 as a probability changeexponentiate for an odds ratio
p=.03p = .03 means a 3% chance that H0H_0 is trueit is the probability of data this extreme if H0H_0 were true
A 95% CI contains 95% of the datait 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 rr of one predictor to get R2R^2R2=r2R^2 = r^2 only in simple regression

Self-test questions

  1. Write the standard error of a difference between two independent means without assuming equal variances.
  2. A sample of n=25n = 25 has s=10s = 10. What is the SE of the mean, and how big must nn be to halve it?
  3. Write Bayes' theorem for P(H∣E)P(H \mid E) and explain in one sentence why the base rate matters.
  4. In a 3 x 4 contingency table, what are the degrees of freedom for the chi-square test of independence?
  5. A logistic regression gives b1=0.5b_1 = 0.5. What is the odds ratio for a one-unit increase in xx?
  6. Why does scipy.stats.ttest_ind(a, b) give a different p-value from R's t.test(a, b) on the same data?

My notes and next steps

Formula I keep missingWhy I miss itCard added (Y/N)Re-test date
Example: Welch dfI forget to square the numeratorYYYYY-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: b1=2.998b_1 = 2.998; b0=72.6−2.998×5.9=54.91b_0 = 72.6 - 2.998 \times 5.9 = 54.91; R2=0.855R^2 = 0.855; SE(b1)=0.437SE(b_1) = 0.437; 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: p^=32/40=0.80\hat{p} = 32/40 = 0.80. SE under H0H_0: 0.9×0.1/40=0.0474\sqrt{0.9 \times 0.1/40} = 0.0474. z=(0.80−0.90)/0.0474=−2.108z = (0.80-0.90)/0.0474 = -2.108, two-sided p=.035p = .035. The exact binomial test gives p=.057p = .057 because it uses the discrete binomial distribution directly; with only n(1−p0)=4n(1-p_0) = 4 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 α=0.05\alpha = 0.05, a reason to report the estimate and interval rather than only "significant".

Self-test:

  1. SE=s12/n1+s22/n2SE = \sqrt{s_1^2/n_1 + s_2^2/n_2}.
  2. SE=10/25=2SE = 10/\sqrt{25} = 2. To halve it you need four times the sample size, n=100n = 100.
  3. P(H∣E)=P(E∣H)P(H)/[P(E∣H)P(H)+P(E∣¬H)P(¬H)]P(H \mid E) = P(E \mid H)P(H) / [P(E \mid H)P(H) + P(E \mid \neg H)P(\neg H)]. When HH is rare, false positives from the large group of non-cases can outnumber true positives (PPV 0.162 in the check table).
  4. df=(3−1)(4−1)=6df = (3-1)(4-1) = 6.
  5. OR=e0.5=1.649\text{OR} = e^{0.5} = 1.649: the odds are multiplied by about 1.65 per unit of xx.
  6. scipy's default is the pooled-variance t-test (equal_var=True); R's default is Welch. Use equal_var=False.

Revision history

VersionDateAuthorChange
0.1YYYY-MM-DD[Name]First version from template
[0.2]YYYY-MM-DD[Name][Added formulas from week 8]

Templat terkait