OlveraeUNSW
Back to topics

Exam cheatsheet

Skim it 10 minutes before the exam.

0 · Imports

import numpy as np
from scipy import stats
import math

1 · 8 functions

WhatPythonMATLAB
Meannp.mean(x)mean(x)
Sample sdnp.std(x, ddof=1)std(x)
Sample varnp.var(x, ddof=1)var(x)
Normal CDFstats.norm.cdf(x, mu, sig)normcdf(x,mu,sig)
Normal quantilestats.norm.ppf(p)norminv(p)
t quantilestats.t.ppf(p, df)tinv(p,df)
Binomial CDFstats.binom.cdf(k, n, p)binocdf(k,n,p)
Poisson CDFstats.poisson.cdf(k, lam)poisscdf(k,lam)
Note ddof=1 — forget it and the whole question cascades. MATLAB defaults correct.

2 · 5 distributions

DistEVarNotes
Bin(n,p)npnp(1−p)P(X≥k)=1−cdf(k−1)
Poi(λ)λλλ (equal) · E[Y²]=λ+λ²
U(a,b)(a+b)/2(b−a)²/12quantile = a+p(b−a)
Exp(mean=m)mm²F(t)=1−e^(−t/m)
N(μ,σ)μσ²norm.cdf / ppf
pdf f(x)=c/x²integrateintegrate → F(t)=1−c/t

3 · 6 key formulas

Square of expectation

E[X2]=Var⁡(X)+(E[X])2E[X^{2}]=\operatorname{Var}(X)+\big(E[X]\big)^{2}

for topics 8/11/17/20 (b)

CLT · sum

S∼N(nμ, nσ2),σS=n σS\sim N(n\mu,\ n\sigma^{2}),\quad \sigma_S=\sqrt{n}\,\sigma

topics 5, 9

CLT · mean

Xˉ∼N(μ, σ2n),σXˉ=σn\bar X\sim N\Big(\mu,\ \frac{\sigma^{2}}{n}\Big),\quad \sigma_{\bar X}=\frac{\sigma}{\sqrt{n}}

topics 10, 12, 14

t confidence interval

xˉ±t n−1,  1+γ2⋅sn\bar x\pm t_{\,n-1,\;\frac{1+\gamma}{2}}\cdot\frac{s}{\sqrt{n}}

topics 4, 6, 7, 15

Proportion margin of error

ME=z∗p^(1−p^)n\text{ME}=z^{*}\sqrt{\frac{\hat p(1-\hat p)}{n}}

topic 1 · normal ⟺ n·p̂(1−p̂) > 5

Estimators

E[∑aiXi]=∑aiμ,Var⁡=∑ai2σ2E\Big[\sum a_iX_i\Big]=\sum a_i\mu,\quad \operatorname{Var}=\sum a_i^{2}\sigma^{2}

unbiased ⟺ Σaᵢ=1 · consistent ⟺ Var→0

4 · Solve-back templates

# critical value (sum, right tail α)
L = n*mu + stats.norm.ppf(1-alpha)*np.sqrt(n)*sigma
# critical value (mean, left tail α)
c = mu + stats.norm.ppf(alpha)*sigma/np.sqrt(n)      # z is negative
# sample size (one-sided)
z = stats.norm.ppf(alpha)
n = math.ceil( (z*sigma/(c-mu))**2 )                 # <- ceil, round up
# sample size (two-sided, total defect rate alpha)
z = stats.norm.ppf(1-alpha/2)                        # <- alpha/2 !
n = math.ceil( (z*sigma/half_width)**2 )

5 · Pre-submit checklist (each has cost marks)

  1. Did you write ddof=1 ?
  2. CI uses t.ppf not norm.ppf ? df = n−1 ? quantile (1+γ)/2 ?
  3. "at least k" = 1 − cdf(k−1) ? (not 1 − cdf(k))
  4. E[X²] = Var + mean² , not (E[X])² ?
  5. CLT: sum uses √n·σ , mean uses σ/√n — not swapped?
  6. Solve-back n uses ceil ? two-sided uses α/2 ?
  7. Proportion normality via n·p̂(1−p̂)>5 , not n>30 ?
  8. Answer ≥3 dp ? rounded when integer required ?