ECE 310 Final formula sheet: MLE, CLT, Neyman–Pearson
Side 1 of 2
Notation: \(n\) = sample size (a count), \(i=1,\dots,n\). \(\bar x=\frac1n\sum x_i\). \(\hat\theta\) = estimate. \(\mu\) = mean (\(m\) on midterm sheets). Red ✗ = mistake to avoid. Colours: MLE, CLT, N–P.
Step 0 for every problem: the givens table
Every number in the question lands in a cell. A leftover number means you misread something.
RV\(X\) = … in words (+ units)
Distributionname + pmf/pdf; discrete or continuous
Unknown / hypotheses\(\theta=?\) or \(H_0\): …, \(H_1\): …
Given\(n\), data, \(\sum x_i\), \(\mu,\sigma^2\), \(\alpha\) … each labelled
Askedexactly what to find
TypeMLE / CLT / N–P (match the “Spot it” boxes)
Answer layout: plan paragraph (type + steps) → givens table → numbered steps → boxed answer with units → sanity check (\(0\le P\le1\), Var \(\ge0\), \(\hat\theta\) in range, \(P_D\ge\alpha\)). Negatives in (parentheses).
1 MLE: maximum likelihood
Spot it: “maximum likelihood”, “MLE”, “estimate \(\theta\) from observations \(x_1,\dots,x_n\)”.
Recipe
- Givens. \(n\), the data, \(\sum x_i\) (and \(\sum x_i^2\) for Gaussian \(\sigma^2\) / Rayleigh).
- Likelihood: one pmf/pdf per sample, \(x\to x_i\), multiplied:
\[L(\theta)=\prod_{i=1}^n f(x_i;\theta)\]
\(\sum\) instead of \(\prod\) (independent ⇒ multiply)leaving \(k\) where \(x_i\) goes
- Collect terms: \(\theta^{\sum x_i}\), \(e^{-n\theta}\), \(c^n\).\(\prod e^{-\lambda}=e^{-\lambda}\); it's \(e^{-n\lambda}\)
- Log: \(\ell=\ln L\). Products → sums. Drop terms with no \(\theta\) (e.g. \(\sum\ln x_i!\)).
- Differentiate in \(\theta\), set \(\ell'(\theta)=0\).
- Solve → \(\hat\theta\), in symbols first.
- Check max: \(\ell''(\hat\theta)<0\).
- Plug in numbers + units (per hour, …).
Support depends on \(\theta\) (Uniform): don't differentiate → Uniform box.
Algebra
\(\prod c=c^n\)\(\prod a^{x_i}=a^{\sum x_i}\)
\(\prod e^{-cx_i}=e^{-c\sum x_i}\)\(\prod e^{-c}=e^{-nc}\)
\(\ln(ab)=\ln a+\ln b\)\(\ln a^b=b\ln a\)
\(\ln(a+b)\ne\ln a+\ln b\)
\(\frac{d}{d\theta}a\ln\theta\)\(=a/\theta\)
\(\frac{d}{d\theta}a\ln(1-\theta)\)\(=-a/(1-\theta)\)
\(\frac{d}{d\theta}(c/\theta)\)\(=-c/\theta^2\)
\(\frac{d}{d\mu}\sum(x_i-\mu)^2\)\(=-2\sum(x_i-\mu)\)
Solve \(\frac a\theta=b\Rightarrow\theta=\frac ab\). \(\ \frac ap=\frac b{1-p}\Rightarrow p=\frac a{a+b}\).
MLE · worked
Exponential, full chain
Lifetimes 2, 4, 6 h; \(X\sim\text{Exp}(\lambda)\), \(n=3\), \(\sum x_i=12\).
- \(L=\prod\lambda e^{-\lambda x_i}=\lambda^ne^{-\lambda\sum x_i}\)
- \(\ell=n\ln\lambda-\lambda\sum x_i\)
- \(\ell'=\frac n\lambda-\sum x_i=0\)
- \(\hat\lambda=\frac{n}{\sum x_i}=\frac1{\bar x}\)
- \(\ell''=-\frac{n}{\lambda^2}<0\) ✓ max
- \(\hat\lambda=3/12=0.25\) per hour
Invariance: MLE of \(g(\theta)\) is \(g(\hat\theta)\). Mean life: \(1/\hat\lambda=\bar x=4\) h.
Poisson counts
Data 0, 2, 1, 1 errors/day: \(n=4\), \(\sum x_i=4\).
\(L=\dfrac{\lambda^{\sum x_i}e^{-n\lambda}}{\prod x_i!}\), \(\ \ell=\sum x_i\ln\lambda-n\lambda-\sum\ln x_i!\)
\(\ell'=\frac{\sum x_i}{\lambda}-n=0\Rightarrow\hat\lambda=\bar x=1\)/day
dropping the 0: it's a real sample, \(n=4\)
Bernoulli / anything with \((1-p)\)
\(\ell=\sum x_i\ln p+(n-\sum x_i)\ln(1-p)\)
\(\ell'=\frac{\sum x_i}{p}-\frac{n-\sum x_i}{1-p}=0\Rightarrow\hat p=\frac{\sum x_i}n\)
losing the minus from \(\frac{d}{dp}\ln(1-p)\)
Geometric
\(L=p^n(1-p)^{\sum k_i-n}\)
\(\ell'=\frac np-\frac{\sum k_i-n}{1-p}=0\Rightarrow\hat p=\frac n{\sum k_i}\)
Rayleigh
\(\ell=\sum\ln x_i-2n\ln\sigma-\frac{\sum x_i^2}{2\sigma^2}\)
\(\ell'=-\frac{2n}\sigma+\frac{\sum x_i^2}{\sigma^3}=0\Rightarrow\hat\sigma^2=\frac{\sum x_i^2}{2n}\)
MLE · special cases
Gaussian, two unknowns
\(\ell=-\frac n2\ln(2\pi\sigma^2)-\frac1{2\sigma^2}\sum(x_i-\mu)^2\)
\(\partial_\mu\ell=0\Rightarrow\hat\mu=\bar x\)
\(\partial_{\sigma^2}\ell=0\Rightarrow\hat\sigma^2=\frac1n\sum(x_i-\hat\mu)^2\)
Do \(\hat\mu\) first. If \(\mu\) is known, use \(\mu\), not \(\bar x\).
Uniform\((0,\theta)\): no derivative
\(L(\theta)=\theta^{-n}\) if \(\theta\ge\max x_i\), else \(0\).
\(\theta^{-n}\) decreases, so take the smallest allowed \(\theta\):
\(\hat\theta=\max x_i\)
Data 1.2, 3.7, 2.5 ⇒ \(\hat\theta=3.7\)
\(\ell'=-n/\theta=0\) has no solution; don't stop there
\(\hat\theta=2\bar x=4.93\) (method of moments)
Estimator quality (if asked)
Bias \(=E[\hat\theta]-\theta\) (unbiased if 0). MSE \(=\text{Var}(\hat\theta)+\text{bias}^2\). Consistent: \(\hat\theta\to\theta\) as \(n\to\infty\).
\(E[\bar x]=\mu\), \(\text{Var}(\bar x)=\sigma^2/n\).
\(s^2=\frac1{n-1}\sum(x_i-\bar x)^2\) is unbiased; \(\hat\sigma^2_{\text{MLE}}\) has \(E=\frac{n-1}n\sigma^2\) (biased).
Used everywhere
Mean / variance rules
\(E[aX+b]=aE[X]+b\)
\(\text{Var}(aX+b)=a^2\text{Var}(X)\)\(a\,\text{Var}\); keeping \(+b\)
\(\text{Var}(X)=E[X^2]-(E[X])^2\)
Indep: \(\text{Var}(X\pm Y)=\text{Var}X+\text{Var}Y\)minus: still ADD
\(\sigma=\sqrt{\text{Var}}\): “variance 9” ⇒ \(\sigma=3\)\(\sigma^2\) where \(\sigma\) goes
ECE 310 Final formula sheet: CLT and Neyman–Pearson
Side 2 of 2
2 CLT: sums and averages
Spot it: “sum / total / average of \(n\) iid”, “approximately”, “large \(n\)”, “how many samples”, “sample mean”.
Formulas
\(S_n=\sum_{i=1}^nX_i\) (total), \(\ M_n=S_n/n\) (average)
| \(S_n\) | \(M_n\) |
| Mean | \(n\mu\) | \(\mu\) |
| Var | \(n\sigma^2\) | \(\sigma^2/n\) |
| SD | \(\sigma\sqrt n\) | \(\sigma/\sqrt n\) |
\(\text{Var}(S_n)=n^2\sigma^2\); SD \(=n\sigma\); not squaring a given \(\sigma\)
CLT: \(S_n\approx\mathcal N(n\mu,n\sigma^2)\), \(\ M_n\approx\mathcal N(\mu,\sigma^2/n)\)
\(z=\dfrac{s-n\mu}{\sigma\sqrt n}=\dfrac{m-\mu}{\sigma/\sqrt n}\)
Recipe
- Givens: \(X_i\) in words, its distribution, \(\mu,\sigma^2\) (side-1 table), \(n\).
- Total or average? “total/sum” → \(S_n\); “average” → \(M_n\).
- Mean + SD from the table above.
- Event as inequality. Integer-valued (counts)? Continuity correction: \(P[S\le k]\to P[S\le k+.5]\), \(P[S\ge k]\to P[S\ge k-.5]\).
- Standardize: \(z=(s-\text{mean})/\text{SD}\). Keep the sign.
- Sketch, shade, Q-rule (Q box, side 2).
- Sanity: \(0\le P\le1\); sign of \(z\) matches the sketch.
Find \(n\)
“\(P[|M_n-\mu|<\varepsilon]\ge1-\alpha\)” ⇒ \(2Q(\varepsilon\sqrt n/\sigma)\le\alpha\)
\(n\ge\left(\dfrac{z_{\alpha/2}\,\sigma}{\varepsilon}\right)^2\) round UP
rounding down; \(z_\alpha\) instead of \(z_{\alpha/2}\) for \(|\cdot|\)
Bernoulli, unknown \(p\): worst case \(\sigma^2\le\frac14\).
Exact sums (no CLT)
Gaussian → \(\mathcal N(n\mu,n\sigma^2)\); Exp\((\lambda)\) → Erlang\((n,\lambda)\); Bern\((p)\) → Bin\((n,p)\); Poisson\((\lambda)\) → Poisson\((n\lambda)\).
Bound vs approximation
“Bound / at most” → Chebyshev: \(P[|M_n-\mu|\ge\varepsilon]\le\frac{\sigma^2}{n\varepsilon^2}\). “Approximately” → CLT.
Confidence interval (\(\sigma\) known)
\(M_n\pm z_{\alpha/2}\,\sigma/\sqrt n\); 95%: \(z=1.96\).
3 Neyman–Pearson test
Spot it: “\(H_0\) vs \(H_1\)”, “false alarm”, “significance \(\alpha\)”, “probability of detection”, “most powerful”, “likelihood ratio”.
Vocabulary
\(P_{FA}=\alpha\)\(P[\text{say }H_1\mid H_0]\) (Type I)
\(P_M=\beta\)\(P[\text{say }H_0\mid H_1]\) (Type II)
\(P_D\)\(P[\text{say }H_1\mid H_1]=1-P_M\)
\(P_D=1-P_{FA}\) (different hypotheses)
N–P lemma
Max \(P_D\) with \(P_{FA}=\alpha\): decide \(H_1\) if
\(\Lambda(x)=\dfrac{f_1(x)}{f_0(x)}>\eta\)
\(f_0/f_1\): \(H_1\) goes on TOP
You never solve for \(\eta\): reduce to \(T\gtrless\gamma\), get \(\gamma\) from \(\alpha\).
Recipe
- Givens: \(X\), \(f_0\), \(f_1\) written out, \(n\), \(\alpha\), what's asked.
- Ratio \(\Lambda=f_1/f_0\); \(n\) samples: \(\prod f_1(x_i)/\prod f_0(x_i)\).
- Log + cancel common factors (\(\frac1{\sqrt{2\pi\sigma^2}}\), \(x_i!\)).
- Isolate statistic \(T\) (\(x\), \(\sum x_i\), \(\bar x\)) → \(T>\gamma\) or \(T<\gamma\). Constants go into \(\gamma\).dividing by a negative and NOT flipping
- \(\gamma\) from \(\alpha\) with the \(H_0\) distribution: \(P[\text{reject region}\mid H_0]=\alpha\).using \(H_1\) for \(P_{FA}\)
- \(P_D\): same region, same \(\gamma\), \(H_1\) distribution.
- Sanity: \(P_D\ge\alpha\); state the rule in words.
Gaussian mean shift (\(\sigma\) known)
\(H_0:\mathcal N(\mu_0,\sigma^2)\) vs \(H_1:\mathcal N(\mu_1,\sigma^2)\)
\[\ln\Lambda=\tfrac{\mu_1-\mu_0}{\sigma^2}\textstyle\sum x_i-\tfrac{n(\mu_1^2-\mu_0^2)}{2\sigma^2}\]
Under \(H_j\): \(\bar x\sim\mathcal N(\mu_j,\sigma^2/n)\), SD \(=\sigma/\sqrt n\).
| \(\mu_1>\mu_0\) | \(\mu_1<\mu_0\) |
| Rule | \(\bar x>\gamma\) | \(\bar x<\gamma\) |
| \(\gamma\) | \(\mu_0+z_\alpha\frac{\sigma}{\sqrt n}\) | \(\mu_0-z_\alpha\frac{\sigma}{\sqrt n}\) |
| \(P_D\) | \(Q\!\left(\frac{\gamma-\mu_1}{\sigma/\sqrt n}\right)\) | \(1-Q\!\left(\frac{\gamma-\mu_1}{\sigma/\sqrt n}\right)\) |
\(\sigma\) instead of \(\sigma/\sqrt n\) when using \(\bar x\)
Exponential rates
\(\Lambda=\frac{\lambda_1}{\lambda_0}e^{-(\lambda_1-\lambda_0)x}\), \(\ \ln\Lambda=\ln\frac{\lambda_1}{\lambda_0}-(\lambda_1-\lambda_0)x\)
\(\lambda_1>\lambda_0\): divide by a negative, flip → \(x<\gamma\). \(\lambda_1<\lambda_0\): \(x>\gamma\).
\(P[X>t]=e^{-\lambda t}\), \(P[X<t]=1-e^{-\lambda t}\). \(n\) samples: \(\sum x_i\sim\) Erlang\((n,\lambda)\), or CLT.
Discrete (Poisson, Binomial)
\(T=\sum x_i\) is an integer, so \(P_{FA}\) jumps: pick \(k\) with the largest \(P[T\ge k\mid H_0]\le\alpha\).
Poisson: \(\ln\Lambda=\sum x_i\ln\frac{\lambda_1}{\lambda_0}-n(\lambda_1-\lambda_0)\).
Related: ROC = \(P_D\) vs \(P_{FA}\). MAP: \(\eta=P[H_0]/P[H_1]\). \(P_e=P[H_0]P_{FA}+P[H_1]P_M\).
N–P · worked
Ex 1 \(n=1\): \(\mu_0=0,\mu_1=2,\sigma=1,\alpha=.05\).
\(\gamma=0+1.645(1)=1.645\)
\(P_D=Q(1.645-2)=Q(-0.355)\)
\(\quad=1-Q(0.355)=0.639\)
Ex 2 \(n=4\): \(\mu_0=0,\mu_1=1,\sigma=2,\alpha=.05\).
SD of \(\bar x=2/\sqrt4=1\); \(\gamma=1.645\); \(P_D=Q(0.645)=0.259\)
Ex 3 decide low: \(H_0:\mathcal N(5,4)\), \(H_1:\mathcal N(3,4)\), \(\alpha=.01\). \(\sigma=2\), rule \(x<\gamma\).
\(\gamma=5-2.326(2)=0.348\)
\(P_D=1-Q\!\left(\frac{0.348-3}{2}\right)=Q(1.326)=0.092\)\(\sigma=4\) (that's the variance)
Ex 4 exponential: \(\lambda_0=1,\lambda_1=2,\alpha=.1\). Rule \(x<\gamma\).
\(1-e^{-\gamma}=0.1\Rightarrow\gamma=-\ln0.9=0.105\)
\(P_D=1-e^{-2\gamma}=1-0.9^2=0.19\)
Ex 5 Poisson: \(\lambda_0=1,\lambda_1=3\), one sample, \(\alpha=.05\). \(\ln\Lambda=x\ln3-2\) ⇒ \(x\ge k\).
\(P[X\ge3\mid1]=.080\), \(P[X\ge4\mid1]=.019\) ⇒ \(k=4\); \(P_D=P[X\ge4\mid3]=0.353\)
CLT · worked
(a) Total \(n=100,\mu=2,\sigma^2=4\), \(P[S>230]\): mean 200, SD \(2\sqrt{100}=20\), \(z=1.5\), \(P=Q(1.5)=0.0668\)
(b) Below mean same, \(P[S<190]\): \(z=(-0.5)\), \(P=1-Q(-0.5)=Q(0.5)=0.309\)
(c) Find \(n\) \(\sigma=1,\varepsilon=0.1\), 95%: \((1.96/0.1)^2=384.2\) ⇒ \(n=385\)
(d) Coin count 100 flips, \(P[S\le55]\): mean 50, SD 5. \(P[S\le55.5]=1-Q(1.1)=0.864\)
(e) Uniform avg \(U(0,1)\), \(n=48\): SD of \(M=\sqrt{\frac1{12\cdot48}}=\frac1{24}\). \(P[M>.55]=Q(1.2)=0.115\)
Q-function (table given in exam)
\(Q(z)=P[Z>z]\), \(z=\frac{x-\mu}{\sigma}\). Sketch + shade first.
\(P[X>x]\)\(Q(z)\)
\(P[X<x]\)\(1-Q(z)\)
\(P[a<X<b]\)\(Q(z_a)-Q(z_b)\)
\(P[|X-\mu|<c]\)\(1-2Q(c/\sigma)\)
\(Q(-z)\)\(1-Q(z)\); \(Q(0)=.5\)
\(x\) below the mean but \(z\) written positive
“less than” \(=Q(z)\); it's \(1-Q\)
| \(\alpha\) | .10 | .05 | .025 | .01 | .005 |
| \(z_\alpha\) | 1.282 | 1.645 | 1.960 | 2.326 | 2.576 |
|---|
Extra page: traps, keywords, algebra, Q-table
Extra: on screen only, not in the PDF
My traps
1. Name the RV + distribution before computing.
2. \(L\) is a PRODUCT \(\prod\) (independent ⇒ multiply). \(\sum\) only appears after \(\ln\).
3. \(n\) = number of data values, NOT a constant like “10 per batch”.
4. \(k\) (or \(x\)) in the pmf/pdf is a placeholder ⇒ becomes \(x_i\).
5. Differentiate w.r.t. the PARAMETER. \(x_i\) and \(n\) are numbers.
6. Rate (\(\lambda\), \(\theta\) in \(e^{-\theta x}\)) ⇒ “per hour”. Mean ⇒ data units.
7. \(\text{Var}(S)=n\sigma^2\) (SQUARE \(\sigma\)!); SD of \(S=\sigma\sqrt n\); SD of \(\bar X=\sigma/\sqrt n\).
8. Value left of mean ⇒ \(z<0\) (keep the minus!). \(Q(-z)=1-Q(z)\).
9. Dividing by a negative FLIPS the inequality.
Decode (before any maths)
\(X\) = what is counted or timed. Count ⇒ discrete (pmf); time/length ⇒ continuous (pdf).
Distribution: \(X\sim\) Name\((\theta)\).
Parameter = the letter in “find the MLE of ___”.
Known constants: “batches of 10”, “\(\sigma=0.2\) given”.
\(n\) = count the data values.
Data \(x_1\dots x_n\): compute \(\sum x_i\) now; note units.
Symbols
\(n\) = how many data values (a count, not a last index)
\(x_i\) = the \(i\)-th data value, \(i=1,\dots,n\)
\(\prod\) = multiply all terms; \(\sum\) = add all terms
\(\hat\theta\) = the MLE; \(L(\theta)\) likelihood; \(\ell(\theta)=\ln L(\theta)\)
MLE recipe (short)
1) Define the RV, name its distribution.
2) \(L(\theta)=\prod_{i=1}^n f(x_i;\theta)\), then collect terms.
3) \(\ell(\theta)=\ln L(\theta)\), simplify to sums.
4) \(\ell'(\theta)=0\), solve for \(\hat\theta\).
5) \(\ell''(\theta)<0\) ⇒ maximum.
6) Plug in numbers, give units.
Finish
\(\ell''<0\) ⇒ concave ⇒ maximum
Invariance: MLE of \(g(\theta)\) is \(g(\hat\theta)\) (mean \(1/\lambda\) ⇒ \(1/\hat\lambda\))
Units: rate ⇒ per hour; mean ⇒ data units; probability ⇒ none
Sanity: \(0\le\hat p\le1\), rate \(>0\), compare with \(\bar x\)
Plan: “Define RV + distribution, \(L\) as a product, \(\ln\) to sums, \(\ell'=0\) for \(\hat\theta\), \(\ell''<0\) for max, numbers + units.”
Collecting terms in \(L\)
\(n\) copies of a factor with no \(i\): \(\theta\cdots\theta=\theta^n\); \(c\cdots c=c^n\)
Same base, exponents add: \(a^{x_1}a^{x_2}\cdots=a^{\sum x_i}\)
\(\sum(x_i-1)=\sum x_i-n\); \(\sum(1-x_i)=n-\sum x_i\)
\(e^ae^b=e^{a+b}\) ⇒ \(\prod e^{-\theta x_i}=e^{-\theta\sum x_i}\)
Log rules
\(\ln(ab)=\ln a+\ln b\) ⇒ \(\ln\prod=\sum\ln\)
\(\ln(a^k)=k\ln a\)
\(\ln(e^a)=a\)
Term with no \(\theta\) ⇒ constant, derivative 0 (e.g. \(-\sum\ln x_i!\))
Derivatives and solving \(\ell'=0\)
\(\frac{d}{d\theta}(c\theta)=c\); \(\ \frac{d}{d\theta}\ln\theta=\frac1\theta\); \(\ \frac{d}{dp}\ln(1-p)=\frac{-1}{1-p}\) (chain-rule minus!)
\(\frac ap-\frac b{1-p}=0\) ⇒ \(\times p(1-p)\) ⇒ \(a(1-p)=bp\) ⇒ \(p=\frac a{a+b}\)
\(\frac c\theta-d=0\) ⇒ \(\theta=\frac cd\)
\(\sum(x_i-\mu)=\sum x_i-n\mu=0\) ⇒ \(\mu=\sum x_i/n\)
CLT quick lines (mean \(m\), variance \(\sigma^2\))
\(S_n=\sum X_i\approx\mathcal N(nm,n\sigma^2)\)
\(\bar X=S_n/n\approx\mathcal N(m,\sigma^2/n)\)
\(P[a<S<b]\approx Q(z_a)-Q(z_b)\); \(\ P[S>s]\approx Q(z)\)
\(P[|\bar X-m|<\varepsilon]\approx1-2Q(\varepsilon\sqrt n/\sigma)\)
Var of one \(X\): Bern \(pq\) · Poisson \(\lambda\) · Exp \(1/\lambda^2\) · Unif\((a,b)\) \((b-a)^2/12\)
N–P quick lines
Take \(\ln\); common constants cancel; move all non-\(x\) terms to the right
Reduce to \(x\gtrless\gamma\) (or \(\sum x_i\gtrless\gamma\)). Check direction against the means
\(P_{FA}=P[\text{decide }H_1\mid H_0]=\alpha\) (size)
\(P_D=P[\text{decide }H_1\mid H_1]\) (power); \(P_M=1-P_D\)
Gaussian, \(x>\gamma\): \(P_{FA}=Q\big(\frac{\gamma-m_0}\sigma\big)\) ⇒ \(\gamma=m_0+\sigma Q^{-1}(\alpha)\)
\(P_D=Q\big(\frac{\gamma-m_1}\sigma\big)\) (\(z\) often \(<0\)!)
\(n\) samples: \(S=\sum x_i\sim\mathcal N(nm,n\sigma^2)\) under each \(H\) (CLT if not Gaussian)
Q-function: \(Q(z)=P[Z>z]\)
\(Q(z)=1-\Phi(z)\); \(Q(0)=0.5\)
\(Q(-z)=1-Q(z)\)
Inverse: find \(p\) in the table body ⇒ read \(z\) (that \(z\) is \(Q^{-1}(p)\))
Key values: \(Q(1)=.1587\) · \(Q(1.645)=.05\) · \(Q(1.96)=.025\) · \(Q(2)=.0228\) · \(Q(2.326)=.01\) · \(Q(2.576)=.005\) · \(Q(3)=.00135\)