STAT 6160 • Experimental Design • Fall 2026
2026-08-27
\[ \newcommand{\pa}[1]{\left(#1\right)} \newcommand{\pb}[1]{\left\{#1\right\}} \newcommand{\pc}[1]{\left[#1\right]} \newcommand{\pA}[1]{\Big(#1\Big)} \newcommand{\pB}[1]{\Big\{#1\Big\}} \newcommand{\pC}[1]{\Big[#1\Big]} \newcommand{\eq}[1]{\begin{align}{#1}\end{align}} \newcommand{\eref}[1]{Eq.~\eqref{#1}} \newcommand{\pref}[1]{part~(\ref{#1})} \newcommand{\nn}{\nonumber} \newcommand{\n}{\nonumber\\} \newcommand{\f}{\frac} \newcommand{\defeq}{\stackrel{\small\bullet}{=}} \newcommand{\ra}{\rangle} \newcommand{\la}{\langle} \newcommand{\norm}[1]{\left\|#1\right\|} \newcommand{\abs}[1]{\left\lvert#1\right\rvert} \newcommand{\Abs}[1]{\Bigl\lvert#1\Bigr\rvert} \newcommand{\pr}{{\mathbb P}} \newcommand{\qr}{{\mathbb Q}} \newcommand{\xv}{{\boldsymbol{x}}} \newcommand{\av}{{\boldsymbol{a}}} \newcommand{\bv}{{\boldsymbol{b}}} \newcommand{\cv}{{\boldsymbol{c}}} \newcommand{\dv}{{\boldsymbol{d}}} \newcommand{\ev}{{\boldsymbol{e}}} \newcommand{\fv}{{\boldsymbol{f}}} \newcommand{\gv}{{\boldsymbol{g}}} \newcommand{\hv}{{\boldsymbol{h}}} \newcommand{\nv}{{\boldsymbol{n}}} \newcommand{\sv}{{\boldsymbol{s}}} \newcommand{\tv}{{\boldsymbol{t}}} \newcommand{\uv}{{\boldsymbol{u}}} \newcommand{\vv}{{\boldsymbol{v}}} \newcommand{\wv}{{\boldsymbol{w}}} \newcommand{\zerov}{{\mathbf{0}}} \newcommand{\onev}{{\mathbf{1}}} \newcommand{\phiv}{{\boldsymbol{\phi}}} \newcommand{\cc}{{\check{C}}} \newcommand{\xv}{{\boldsymbol{x}}} \newcommand{\Xv}{{\boldsymbol{X}\!}} \newcommand{\yv}{{\boldsymbol{y}}} \newcommand{\Yv}{{\boldsymbol{Y}}} \newcommand{\zv}{{\boldsymbol{z}}} \newcommand{\Zv}{{\boldsymbol{Z}}} \newcommand{\Iv}{{\boldsymbol{I}}} \newcommand{\Jv}{{\boldsymbol{J}}} \newcommand{\Cv}{{\boldsymbol{C}}} \newcommand{\Ev}{{\boldsymbol{E}}} \newcommand{\Fv}{{\boldsymbol{F}}} \newcommand{\Gv}{{\boldsymbol{G}}} \newcommand{\Hv}{{\boldsymbol{H}}} \newcommand{\alphav}{{\boldsymbol{\alpha}}} \newcommand{\epsilonv}{{\boldsymbol{\epsilon}}} \newcommand{\betav}{{\boldsymbol{\beta}}} \newcommand{\deltav}{{\boldsymbol{\delta}}} \newcommand{\gammav}{{\boldsymbol{\gamma}}} \newcommand{\etav}{{\boldsymbol{\eta}}} \newcommand{\piv}{{\boldsymbol{\pi}}} \newcommand{\thetav}{{\boldsymbol{\theta}}} \newcommand{\tauv}{{\boldsymbol{\tau}}} \newcommand{\muv}{{\boldsymbol{\mu}}} \newcommand{\argmin}{\mathop{\text{arg}\ \!\text{min}}} \newcommand{\arginf}{\mathop{\text{arg}\ \!\text{inf}}} \newcommand{\argmax}{\mathop{\text{arg}\ \!\text{max}}} \newcommand{\argsup}{\mathop{\text{arg}\ \!\text{sup}}} \newcommand{\f}{\frac} \newcommand{\e}{\epsilon} \newcommand{\b}{\bullet} \newcommand{\inv}{^{-1}} \newcommand{\A}{{\mathcal A}} \newcommand{\C}{{\mathbb C}} \newcommand{\E}{{\mathbb E}} \newcommand{\F}{{\mathcal{F}}} \newcommand{\N}{{\mathbb N}} \newcommand{\R}{{\mathbb R}} \newcommand{\Q}{{\mathbb Q}} \newcommand{\Z}{{\mathbb Z}} \newcommand{\X}{{\mathbb{X}}} \newcommand{\Y}{{\mathbb{Y}}} \newcommand{\G}{{\mathcal{G}}} \newcommand{\M}{{\mathcal{M}}} \newcommand{\Xn}{X_1, \dots, X_n} \newcommand{\Xm}{X_1, \dots, X_m} \newcommand{\Yn}{Y_1, \dots, Y_n} \newcommand{\Ym}{Y_1, \dots, Y_m} \newcommand{\Xb}{{\mathbb{X}}} \newcommand{\Yb}{{\mathbb{Y}}} \newcommand{\s}{{{\sigma}}} %%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\c}{^c} \newcommand{\bar}{\overline} \newcommand{\indep}{\perp\kern-6pt \perp} \newcommand{\pr}{{\mathbb P}} \newcommand{\R}{{\mathbb R}} \newcommand{\E}{{\mathbb E}} \newcommand{\var}{\text{Var}} \newcommand{\sd}{\text{SD}} \newcommand{\se}{\text{SE}} \newcommand{\ssres}{{\mathrm{SS}_{\mathrm{Res}}}} \newcommand{\sstrt}{{\mathrm{SS}_{\mathrm{Trt}}}} \newcommand{\sstot}{{\mathrm{SS}_{\mathrm{Tot}}}} \newcommand{\rank}{\mathop{\mathrm{rank}}} \newcommand{\supp}{\text{supp}} \newcommand{\Unif}{{\text{Unif}}} \newcommand{\Ber}{{\text{Ber}}} \newcommand{\Bin}{{\text{Bin}}} \newcommand{\Geo}{{\text{Geo}}} \newcommand{\Poi}{{\text{Poi}}} \newcommand{\Exp}{{\text{Exp}}} \newcommand{\Chisq}{{\chi^2}} \newcommand{\iid}{{\stackrel{iid}{\sim}}} \newcommand{\px}{p_{X}} \newcommand{\py}{p_{Y}} \newcommand{\pxy}{p_{X,Y}} \newcommand{\fx}{f_{X}} \newcommand{\fz}{f_{Z}} \newcommand{\fy}{f_{Y}} \newcommand{\fxy}{f_{X,Y}} \newcommand{\Fx}{F_{X}} \newcommand{\Fz}{F_{Z}} \newcommand{\Fy}{F_{Y}} \newcommand{\Fxy}{F_{X,Y}} \newcommand{\Xbar}{\overline{X}} \newcommand{\Ybar}{\overline{Y}} \newcommand{\Zbar}{\overline{Z}} \newcommand{\nXbar}{n \cdot \overline{X}} \newcommand{\nYbar}{n \cdot \overline{Y}} \newcommand{\nZbar}{n \cdot \overline{Z}} \newcommand{\Xn}{X_1, X_2, \dots, X_n} \newcommand{\Xm}{X_1, X_2, \dots, X_m} \newcommand{\Ym}{Y_1, Y_2, \dots, Y_m} \newcommand{\sumXn}{X_1 + X_2 + \dots + X_n} \newcommand{\la}{\ell_\alpha} \newcommand{\ua}{u_\alpha} \newcommand{\at}{{\alpha/2}} %%\renewcommand{\hat}{\widehat} \newcommand{\mux}{\mu_{X}} \newcommand{\muy}{\mu_{Y}} \newcommand{\sx}{\sigma_{X}} \newcommand{\sy}{\sigma_{Y}} \newcommand{\pvalue}{$p$-value} \newcommand{\Ho}{H_{0}} \newcommand{\Ha}{H_{a}} \]
§1. Setting up an inference problem
§2. Sampling distributions
§3. Confidence intervals
§4. Hypothesis testing
§5. Simple linear regression
§6. Multiple regression in matrix form
§7. Estimating the parameters
§8. ANOVA and general linear hypotheses
Every inference problem starts with a description of how the data came to exist.
Assumption
\(X_1, \ldots, X_n \sim D(\theta)\), drawn independently from a distribution \(D\) with unknown parameter \(\theta\)
| \(D\) | Assumption | \(\supp(X)\) | \(\theta\) |
|---|---|---|---|
| Bernoulli | \(\Xn \sim \Ber(p)\) | {0, 1} | \(p \in (0, 1)\) |
| Poisson | \(\Xn \sim \Poi(\lambda)\) | {0, 1, 2, …} | \(\lambda \in (0, \infty)\) |
| Normal | \(\Xn \sim \mathcal{N}(\mu, \sigma^2)\) | \(\R\) | \(\mu \in \R\), \(\sigma^2 \in (0, \infty)\) |
| Exponential | \(\Xn \sim \mathrm{Exp}(\lambda)\) | \((0, \infty)\) | \(\lambda \in (0, \infty)\) |
Two separate claims are being made here:
In a designed experiment, the second claim is something you arrange through randomization rather than something you assume.
The support of \(X_i\), \(\supp(X)\), is the set of values it can take. It constrains which \(D\) is available.
| Type | Example support | Typical \(D\) |
|---|---|---|
| Binary | \(\{0, 1\}\) | \(\mathrm{Ber}(\theta)\) |
| Count | \(\{0, 1, 2, \ldots\}\) | \(\mathrm{Poi}(\lambda)\), \(\mathrm{Bin}(n,\theta)\) |
| Categorical | \(\{\text{A}, \text{B}, \text{C}\}\) | \(\mathrm{Mult}(1, \boldsymbol{\pi})\) |
| Ordinal | \(\{\text{low}, \text{med}, \text{high}\}\) | ordered categorical |
| Positive continuous | \((0, \infty)\) | \(\mathrm{Exp}(\lambda)\), \(\mathrm{Gamma}\), lognormal |
| Continuous | \(\R\) | \(\mathcal{N}(\mu, \sigma^2)\) |
The support narrows the choice of \(D\), but it does not determine it. Two distributions with the same support can disagree about everything else.
Categorical and ordinal responses have to be encoded before they enter a linear model. We will use one-hot and dummy encodings for this in §6.
Typos on a page is the stock Poisson example. Typos cluster: a bad paragraph has several. Which Poisson assumption does that break, and which way does it push \(\var(X)\) relative to \(\E[X]\)?
Population parameter
\(\theta\) is a fixed, unknown number describing the population. It does not depend on the sample.
Statistic
\(\hat\theta = \hat\theta(X_1, \ldots, X_n)\) is a function of the data. It is our best guess for \(\theta\).
The observed data \(x_1, \ldots, x_n\) are realizations of the random variables \(X_1, \ldots, X_n\). Because \(\hat\theta\) is a function of random variables, \(\hat\theta\) is itself a random variable.
\[ \theta \ \text{is fixed and unknown}, \qquad \hat\theta \ \text{is random and observed} \]
A clinic has exactly 300 patients and you measure the outcome on all 300. Is the mean of those 300 numbers a parameter or a statistic?
For a sample of size \(n\) from \(\mathcal{N}(\mu, \sigma^2)\) with \(\hat\mu = \bar X\):
\[ \E[\hat\mu] = \mu, \qquad \var(\hat\mu) = \frac{\sigma^2}{n}, \qquad \se(\hat\mu) = \frac{\sigma}{\sqrt{n}} \]
Standard error
The standard error of a statistic is the standard deviation of its distribution.
Reporting \(\hat\theta\) alone is incomplete. What makes it an inference is the attached statement about how much \(\hat\theta\) varies, and that statement comes from the distribution of \(\hat\theta\).
That \(\sigma^2/n\) used independence. If instead every pair of observations has correlation \(\rho > 0\), what is \(\var(\hat\mu)\), and what does it tend to as \(n \to \infty\)?
Sampling distribution
The sampling distribution of \(\hat\theta\) is the distribution of \(\hat\theta\) when \(X_1, \ldots, X_n\) are drawn from \(D(\theta)\).
It depends on three things:
It does not depend on the data you happened to observe. It is a property of the data collection process.
Call the process of collecting \(X_1, \ldots, X_n \sim D(\theta)\) an experiment. Repeat the experiment \(N\) times:
\[ \begin{aligned} \text{1st experiment:} \quad & X^{(1)}_1, \ldots, X^{(1)}_n \sim D(\theta) \ \longrightarrow \ \hat\theta^{(1)} \\ \text{2nd experiment:} \quad & X^{(2)}_1, \ldots, X^{(2)}_n \sim D(\theta) \ \longrightarrow \ \hat\theta^{(2)} \\ & \ \ \vdots \\ N\text{th experiment:} \quad & X^{(N)}_1, \ldots, X^{(N)}_n \sim D(\theta) \ \longrightarrow \ \hat\theta^{(N)} \end{aligned} \]
The histogram of \(\hat\theta^{(1)}, \ldots, \hat\theta^{(N)}\) approximates the sampling distribution of \(\hat\theta\).
In practice you run the experiment once. The other \(N-1\) experiments are hypothetical, and the sampling distribution is a statement about them.
On the next slide you can change both \(n\) and \(N\). Commit now: which of the two changes the width of the histogram of \(\hat\theta\), and which does not?
For \(X_1, \ldots, X_n\) iid:
\[ \begin{aligned} X_i \sim \mathrm{Ber}(\theta), \quad \hat\theta = \bar X \quad &\Longrightarrow \quad \hat\theta \sim \tfrac{1}{n}\mathrm{Bin}(n, \theta) \\[4pt] X_i \sim \mathcal{N}(\mu, \sigma^2), \quad \hat\mu = \bar X \quad &\Longrightarrow \quad \hat\mu \sim \mathcal{N}\!\pa{\mu, \tfrac{\sigma^2}{n}} \\[4pt] X_i \sim \mathcal{N}(\mu, \sigma^2), \quad \hat\sigma^2 = \tfrac{1}{n-1}\textstyle\sum_i (X_i - \bar X)^2 \quad &\Longrightarrow \quad \hat\sigma^2 \sim \tfrac{\sigma^2}{n-1}\chi^2_{n-1} \\[4pt] X_i \sim \mathrm{Exp}(\lambda), \quad \hat\lambda = \bar X \quad &\Longrightarrow \quad \hat\lambda \sim \tfrac{1}{n}\mathrm{Gamma}(n, n\lambda) \end{aligned} \]
In the normal case \(\bar X\) and \(\hat\sigma^2\) are independent, and
\[ \frac{\hat\mu - \mu}{\sqrt{\hat\sigma^2 / n}} \ \sim \ t_{n-1} \]
Let \(Z, Z_1, Z_2, \ldots\) be iid \(\mathcal{N}(0,1)\).
\[ \begin{aligned} \chi^2_\nu \ &= \ \sum_{i=1}^{\nu} Z_i^2 & &\E = \nu, \quad \mathrm{Var} = 2\nu \\[6pt] t_\nu \ &= \ \frac{Z}{\sqrt{\chi^2_\nu / \nu}}, \quad Z \indep \chi^2_\nu & &\text{symmetric, heavier tails than } \mathcal{N}(0,1) \\[6pt] F_{\nu_1, \nu_2} \ &= \ \frac{\chi^2_{\nu_1} / \nu_1}{\chi^2_{\nu_2} / \nu_2}, \quad \chi^2_{\nu_1} \indep \chi^2_{\nu_2} & &\text{ratio of two variance estimates} \end{aligned} \]
Useful identities:
\[ t_\nu^2 \ \stackrel{d}{=} \ F_{1, \nu}, \qquad \nu_1 F_{\nu_1, \infty} \ \stackrel{d}{=} \ \chi^2_{\nu_1}, \qquad t_\nu \ \xrightarrow{d} \ \mathcal{N}(0,1) \ \text{ as } \nu \to \infty \]
\(\chi^2\) appears for sums of squares, \(t\) for a single coefficient or contrast, \(F\) for comparing two sums of squares.
Law of large numbers
\(\displaystyle \frac{1}{n}\sum_{i=1}^n X_i \longrightarrow \E[X]\) as \(n \to \infty\).
Central limit theorem
\(\displaystyle \frac{\bar X - \E[X]}{\sqrt{\mathrm{Var}(\bar X)}} \Longrightarrow \mathcal{N}(0,1)\) as \(n \to \infty\).
The LLN says the statistic converges to the parameter. The CLT says the sampling distribution of the statistic converges to a normal, whatever \(D\) is.
This is why normal-based intervals and tests are used for statistics that are averages, and why they are not automatic for statistics that are not.
Confidence interval
A \(100 \times (1-\alpha)\%\) confidence interval for \(\theta\) is a pair of statistics \([L, U]\) with \[\pr\pa{L \leq \theta \leq U} = 1 - \alpha\]
\(L\) and \(U\) are computed from the data, so they are random. \(\theta\) is fixed. The probability statement is about the interval, not about \(\theta\).
For a sample mean with \(\sigma^2\) unknown,
\[ \mathrm{CI}(\mu, \alpha) \ = \ \pc{\hat\mu - t_{n-1;\,\alpha/2}\cdot \frac{\hat\sigma}{\sqrt{n}}, \ \ \hat\mu + t_{n-1;\,\alpha/2}\cdot \frac{\hat\sigma}{\sqrt{n}}} \]
The coverage probability is the proportion of repeated experiments in which the interval contains \(\theta\).
\[ \text{coverage} \ = \ \pr\pa{\theta \in [L, U]} \]
Interpretation:
If we repeat the experiment many times and compute \([L, U]\) each time, then \(100 \times (1-\alpha)\%\) of those intervals will contain \(\theta\).
This is the same repeated-experiments picture as §2. A confidence interval is a statement about the procedure, evaluated over the sampling distribution.
Two independent experiments each produce a 95% interval for the same \(\mu\). What is the probability that both cover \(\mu\)? That at least one does?
Assumption
\(X_1, \ldots, X_n \sim D(\theta)\).
Population parameter
\(\theta\), the quantity the hypotheses are about.
Null hypothesis \(H_0\)
A statement about \(\theta\) under the most conservative assumption.
Alternative hypothesis \(H_a\)
The statement about \(\theta\) we want to show evidence in favour of.
Sample statistic
\(\hat\theta\), our best guess for \(\theta\).
Test statistic
\(\hat T = \hat T(X_1, \ldots, X_n)\), the function of the data used to decide between \(H_0\) and \(H_a\).
Rejection region
\(R(\hat T, \alpha)\), the set of values of \(\hat T\) for which we reject \(H_0\).
| \(H_0\) true | \(H_a\) true | |
|---|---|---|
| Fail to reject \(H_0\) | Correct | Type II error |
| Reject \(H_0\) | Type I error | Correct |
A test statistic is built so that its value separates \(H_0\) from \(H_a\). For \(H_0 : \mu = \mu_0\) against \(H_a : \mu \neq \mu_0\):
The distribution of \(\hat T\) under \(H_0\) involves neither \(\mu_0\) nor \(\sigma\). Which of the two operations removed which?
\[ \hat T \ = \ \frac{\hat\mu - \mu_0}{\hat\sigma / \sqrt{n}} \]
Two things are happening:
The scaling is what makes the distribution of \(\hat T\) under \(H_0\) tabulatable: here \(\hat T \sim t_{n-1}\) regardless of \(\mu_0\) and \(\sigma\).
The rejection region is chosen from the sampling distribution of \(\hat T\) under \(H_0\):
\[ R(\hat T, \alpha) \ = \ \pb{\, t : \abs{t} > t_{n-1;\,\alpha/2} \,}, \qquad \pr_{H_0}\pa{\hat T \in R} = \alpha \]
\(p\)-value
\(p \ = \ \pr_{H_0}\pa{\abs{\hat T} \geq \abs{\hat t_{\text{obs}}}}\), the probability under \(H_0\) of a test statistic at least as extreme as the one observed.
Reject \(H_0\) when \(p < \alpha\). This is the same rule as \(\hat T \in R\).
Power
\(\text{power}(\theta) = \pr_\theta\pa{\text{reject } H_0}\), computed under a specific alternative \(\theta\).
Power depends on:
The first is a property of the population. The second is a property of the design. Sample size and variance reduction are the two things an experimenter controls, and both act through the standard error.
Double \(n\), halve \(\sigma\), or double the effect size. Two of these move the power by the same amount. Which two, and why?
A filling line is supposed to dispense \(\mu_0 = 355\) mL per can. Years of process data put the fill-volume standard deviation at \(\sigma = 4\) mL, stable enough to treat as known. After a nozzle change, a sample of \(n = 25\) cans has mean fill \(\hat\mu = 353.2\) mL. Has the line drifted low?
| Assumption | \(X_1, \ldots, X_{25} \sim \mathcal{N}(\mu, 4^2)\), \(\sigma\) known |
| Parameter / statistic | \(\mu\) / \(\hat\mu = \bar X = 353.2\) |
| \(H_0\) vs \(H_a\) | \(\mu = 355\) vs \(\mu < 355\) |
| Test statistic | \(\hat Z = \dfrac{\hat\mu - \mu_0}{\sigma/\sqrt n} \sim \mathcal{N}(0,1)\) under \(H_0\) |
\[ \hat z \ = \ \frac{353.2 - 355}{4/\sqrt{25}} \ = \ \frac{-1.8}{0.8} \ = \ -2.25 \]
Suppose \(\sigma\) were not known, you substituted \(\hat\sigma\), but kept the \(\mathcal{N}(0,1)\) critical value. Would the true Type I error rate be above or below \(\alpha\)?
Two catalysts, independent trials, reaction yield in %.
| Catalyst A | Catalyst B | |
|---|---|---|
| \(n\) | 6 | 6 |
| \(\bar y\) | 71.5 | 68.3 |
| \(s\) | 2.1 | 2.4 |
Assumption
\(Y_{A1},\ldots,Y_{A6} \sim \mathcal{N}(\mu_A,\sigma^2)\) and \(Y_{B1},\ldots,Y_{B6} \sim \mathcal{N}(\mu_B,\sigma^2)\), independent, common \(\sigma^2\).
Parameter \(\theta = \mu_A - \mu_B\). Same two moves as §4: center the difference at \(0\), scale by its standard error.
\[ \hat T \ = \ \frac{\pa{\bar y_A - \bar y_B} - 0}{S_p\sqrt{\tfrac1{n_A}+\tfrac1{n_B}}} \ \sim \ t_{n_A+n_B-2}, \qquad S_p^2 \ = \ \frac{(n_A-1)S_A^2 + (n_B-1)S_B^2}{n_A+n_B-2} \]
Compute \(\hat T\) and decide, at \(\alpha = 0.05\). \(H_0: \mu_A = \mu_B\) against \(H_a: \mu_A \neq \mu_B\).
For pairs \((x_1, y_1), \ldots, (x_n, y_n)\),
\[ y_i \ = \ \beta_0 \ + \ \beta_1 x_i \ + \ \e_i, \qquad i = 1, \ldots, n \]
The assumptions, in the order they will matter:
\[ \begin{aligned} \text{A1.} \quad & \E[\e_i] = 0 && \text{the mean of } y_i \text{ is } \beta_0 + \beta_1 x_i \\[3pt] \text{A2.} \quad & \mathrm{Var}(\e_i) = \sigma^2 && \text{constant variance} \\[3pt] \text{A3.} \quad & \mathrm{Cov}(\e_i, \e_j) = 0, \ i \neq j && \text{uncorrelated errors} \\[3pt] \text{A4.} \quad & \e_i \sim \mathcal{N}(0, \sigma^2) && \text{normality} \end{aligned} \]
\(x_i\) is treated as fixed. The randomness is in \(\e_i\), so \(y_i\) is the random variable and \(\beta_0, \beta_1, \sigma^2\) are the parameters.
Given estimates \(\hat\beta_0, \hat\beta_1\):
\[ \begin{aligned} \text{fitted value} \quad & \hat y_i \ = \ \hat\beta_0 + \hat\beta_1 x_i \\[4pt] \text{residual} \quad & e_i \ = \ y_i - \hat y_i \\[4pt] \text{residual sum of squares} \quad & \ssres \ = \ \sum_{i=1}^n e_i^2 \end{aligned} \]
The residual \(e_i\) is an observable quantity computed from the fit. The error \(\e_i\) is unobservable. They are not the same thing.
Least squares chooses \(\hat\beta_0, \hat\beta_1\) to minimise \(\ssres\):
\[ (\hat\beta_0, \hat\beta_1) \ = \ \argmin_{b_0, b_1} \ \sum_{i=1}^n \pa{y_i - b_0 - b_1 x_i}^2 \]
At the least squares fit,
\[ \underbrace{\sum_{i=1}^n (y_i - \bar y)^2}_{\mathrm{SS_{tot}}} \ = \ \underbrace{\sum_{i=1}^n (\hat y_i - \bar y)^2}_{\mathrm{SS_{reg}}} \ + \ \underbrace{\sum_{i=1}^n (y_i - \hat y_i)^2}_{\ssres} \]
and
\[ R^2 \ = \ \frac{\mathrm{SS_{reg}}}{\mathrm{SS_{tot}}} \ = \ 1 - \frac{\ssres}{\mathrm{SS_{tot}}} \]
The cross term vanishes because \(\sum_i e_i = 0\) and \(\sum_i \hat y_i e_i = 0\) at the least squares fit. In §7 this is the statement that the residual vector is orthogonal to the fitted vector.
\[ \hat\beta_1 \ = \ \frac{\sum_i (x_i - \bar x)(y_i - \bar y)}{\sum_i (x_i - \bar x)^2}, \qquad \hat\beta_0 \ = \ \bar y - \hat\beta_1 \bar x \]
Under A1 to A3,
\[ \E[\hat\beta_1] = \beta_1, \qquad \mathrm{Var}(\hat\beta_1) = \frac{\sigma^2}{\sum_i (x_i - \bar x)^2} \]
Under A4 as well,
\[ \frac{\hat\beta_1 - \beta_1}{\hat\sigma / \sqrt{\sum_i (x_i - \bar x)^2}} \ \sim \ t_{n-2}, \qquad \hat\sigma^2 = \frac{\ssres}{n-2} \]
With \(p-1\) predictors,
\[ y_i \ = \ \beta_0 + \beta_1 x_{i1} + \cdots + \beta_{p-1} x_{i,p-1} + \e_i \]
Stacking the \(n\) equations:
\[ \underbrace{\begin{pmatrix} y_1 \\ y_2 \\ \vdots \\ y_n \end{pmatrix}}_{\yv,\ n \times 1} \ = \ \underbrace{\begin{pmatrix} 1 & x_{11} & \cdots & x_{1,p-1} \\ 1 & x_{21} & \cdots & x_{2,p-1} \\ \vdots & \vdots & & \vdots \\ 1 & x_{n1} & \cdots & x_{n,p-1} \end{pmatrix}}_{\Xv,\ n \times p} \underbrace{\begin{pmatrix} \beta_0 \\ \beta_1 \\ \vdots \\ \beta_{p-1}\end{pmatrix}}_{\betav,\ p \times 1} \ + \ \underbrace{\begin{pmatrix} \e_1 \\ \e_2 \\ \vdots \\ \e_n \end{pmatrix}}_{\epsilonv,\ n \times 1} \]
\[ \yv \ = \ \Xv\betav + \epsilonv \]
\[ \begin{aligned} \text{A1--A3.} \quad & \E[\epsilonv] = \zerov, \quad \mathrm{Var}(\epsilonv) = \sigma^2\Iv_n \\[6pt] \text{A4.} \quad & \epsilonv \sim \mathcal{N}_n(\zerov, \sigma^2\Iv_n) \end{aligned} \]
so that \(\E[\yv] = \Xv\betav\) and \(\mathrm{Var}(\yv) = \sigma^2\Iv_n\).
Two facts used repeatedly, valid for any random vector and fixed \(\boldsymbol{A}, \bv\):
\[ \E[\boldsymbol{A}\yv + \bv] = \boldsymbol{A}\E[\yv] + \bv, \qquad \mathrm{Var}(\boldsymbol{A}\yv + \bv) = \boldsymbol{A}\,\mathrm{Var}(\yv)\,\boldsymbol{A}^\top \]
If \(\yv\) is multivariate normal then \(\boldsymbol{A}\yv + \bv\) is multivariate normal as well.
A treatment factor with \(g\) levels is encoded as columns of \(\Xv\). For \(g = 3\), one observation per level:
Cell means
\[ \Xv = \begin{pmatrix} 1&0&0\\ 0&1&0\\ 0&0&1 \end{pmatrix} \]
\(\betav = (\mu_1, \mu_2, \mu_3)^\top\)
Dummy coding
\[ \Xv = \begin{pmatrix} 1&0&0\\ 1&1&0\\ 1&0&1 \end{pmatrix} \]
\(\betav = (\mu_1,\ \mu_2 - \mu_1,\ \mu_3 - \mu_1)^\top\)
Sum to zero
\[ \Xv = \begin{pmatrix} 1&1&0\\ 1&0&1\\ 1&-1&-1 \end{pmatrix} \]
\(\betav = (\bar\mu,\ \mu_1 - \bar\mu,\ \mu_2 - \bar\mu)^\top\)
All three have the same column space, so they give the same fitted values, residuals and \(\ssres\). They differ in what the individual entries of \(\betav\) mean.
\[ \mathcal{C}(\Xv) \ \text{is the design.} \qquad \betav \ \text{is a coordinate system chosen for describing it.} \]
Group means are \((10, 14, 12)\). Write \(\betav\) under each coding. Which entries change if level 3 is relabelled as the baseline, and which do not?
\[ \hat\betav \ = \ \argmin_{\betav} \ \norm{\yv - \Xv\betav}^2 \]
Differentiating and setting to zero gives the normal equations
\[ \Xv^\top\!\Xv\,\hat\betav \ = \ \Xv^\top\!\yv \]
If \(\Xv\) has full column rank \(p\), then \(\Xv^\top\!\Xv\) is invertible and
\[ \hat\betav \ = \ \pa{\Xv^\top\!\Xv}^{-1}\Xv^\top\!\yv \]
Equivalently, \(\Xv^\top(\yv - \Xv\hat\betav) = \zerov\): the residual vector is orthogonal to every column of \(\Xv\). For simple regression these are the two sums from the widget in §5.
\[ \hat\yv \ = \ \Xv\hat\betav \ = \ \Hv\yv, \qquad \Hv \ = \ \Xv\pa{\Xv^\top\!\Xv}^{-1}\Xv^\top \]
\(\Hv\) is symmetric and idempotent, so it is the orthogonal projection onto the column space \(\mathcal{C}(\Xv)\):
\[ \Hv = \Hv^\top, \qquad \Hv^2 = \Hv, \qquad \Hv\Xv = \Xv \]
and \(\ev = (\Iv - \Hv)\yv\) is the projection onto \(\mathcal{C}(\Xv)^\perp\), with
\[ \mathrm{rank}(\Hv) = \mathrm{tr}(\Hv) = p, \qquad \mathrm{rank}(\Iv - \Hv) = n - p \]
Since \(\hat\yv \perp \ev\), \(\ \norm{\yv}^2 = \norm{\hat\yv}^2 + \norm{\ev}^2\), which is the decomposition from §5.
For \(\xv \in \R^p\), if \(\boldsymbol{\Sigma}\) is positive definite,
\[ \Xv \sim \mathcal{N}_p(\muv, \boldsymbol{\Sigma}) \]
has density
\[ \begin{aligned} f_{\Xv}(\xv) &= \frac{1}{(2\pi)^{p/2}|\boldsymbol{\Sigma}|^{1/2}} \\[-0.2em] &\quad {}× \exp\pc{ -\frac{1}{2}(\xv-\muv)^\top \boldsymbol{\Sigma}^{-1}(\xv-\muv) }. \end{aligned} \]
The contours of equal density are ellipsoids centered at \(\muv\); their shape and orientation are determined by \(\boldsymbol{\Sigma}\).
Let \(\zv \sim \mathcal{N}_p(\zerov,\Iv_p)\).
| Property | Consequence |
|---|---|
| Components | \(Z_1,\ldots,Z_p \iid \mathcal{N}(0,1)\) |
| Spherical symmetry | \(\boldsymbol{Q}\zv \stackrel{d}{=} \zv\) for every orthogonal \(\boldsymbol{Q}\) |
| Linear transformations | \(\boldsymbol{A}\zv+\bv \sim \mathcal{N}_m(\bv,\boldsymbol{A}\boldsymbol{A}^\top)\) |
| Orthogonal projections | If \(\boldsymbol{P}=\boldsymbol{P}^\top=\boldsymbol{P}^2\), then \(\boldsymbol{P}\zv \indep (\Iv-\boldsymbol{P})\zv\) |
| Quadratic forms | \(\zv^\top\boldsymbol{P}\zv \sim \chi^2_{r}\) when \(\mathrm{rank}(\boldsymbol{P})=r\) |
| Centered general normal | If \(\Xv\sim\mathcal{N}_p(\muv,\boldsymbol{\Sigma})\), then \((\Xv-\muv)^\top\boldsymbol{\Sigma}^{-1}(\Xv-\muv)\sim\chi^2_p\) |
With \(\zv=\epsilonv/\sigma\) and \(\boldsymbol{P}=\Hv\) or \(\Iv-\Hv\), these facts produce the \(\chi^2\), independence, \(t\), and \(F\) results used in regression.
Under A1 to A3,
\[ \E[\hat\betav] = \betav, \qquad \mathrm{Var}(\hat\betav) = \sigma^2\pa{\Xv^\top\!\Xv}^{-1} \]
Least squares is unbiased under A1 to A3 alone, with no normality needed. Without proof: it’s also the best such choice. Among all linear unbiased estimators of \(\cv^\top\betav\), \(\cv^\top\hat\betav\) has the smallest variance, for every \(\cv \in \R^p\).
For \(\sigma^2\): a short calculation with \(\Iv - \Hv\) gives
\[ \E\pc{\norm{\ev}^2} = \sigma^2 (n-p) \qquad\Longrightarrow\qquad \hat\sigma^2 = \frac{\ssres}{n - p} \]
Adding A4, \(\epsilonv \sim \mathcal{N}_n(\zerov, \sigma^2\Iv_n)\):
\[ \hat\betav \ \sim \ \mathcal{N}_p\!\pa{\betav, \ \sigma^2(\Xv^\top\!\Xv)^{-1}}, \qquad \frac{\ssres}{\sigma^2} \ \sim \ \chi^2_{n-p}, \qquad \hat\betav \indep \ssres \]
Independence holds because \(\hat\yv = \Hv\yv\) and \(\ev = (\Iv-\Hv)\yv\) are jointly normal with
\[ \mathrm{Cov}\pa{\Hv\yv, (\Iv - \Hv)\yv} \ = \ \sigma^2\Hv(\Iv - \Hv) \ = \ \boldsymbol{0} \]
Combining the normal and the \(\chi^2\) gives, for any \(\cv\),
\[ \frac{\cv^\top\hat\betav - \cv^\top\betav} {\hat\sigma\sqrt{\cv^\top(\Xv^\top\!\Xv)^{-1}\cv}} \ \sim \ t_{n-p} \]
| Question | Null hypothesis | Statistic | What rejection establishes |
|---|---|---|---|
| Does one coefficient or contrast matter? | \(H_0:\cv^\top\betav=d\) | \(t_{n-p}\) | This particular linear combination differs from \(d\) |
| Does the whole regression improve on the mean alone? | \(H_0:\beta_1=\cdots=\beta_{p-1}=0\) | overall \(F_{p-1,\,n-p}\) | At least one predictor contributes signal |
| Do these added terms improve a smaller model? | \(H_0:\Cv\betav=\dv\), \(\mathrm{rank}(\Cv)=q\) | partial \(F_{q,\,n-p}\) | The added terms improve fit beyond noise |
The first test is the \(q=1\) case of the third, and then \(F=t^2\). A categorical factor with several indicator columns needs a joint \(F\)-test; its individual \(t\)-tests do not answer whether the factor matters as a whole.
The intercept-only model predicts \(\bar y\). The full model adds \(p-1\) slopes:
\[ H_0:\beta_1=\cdots=\beta_{p-1}=0 \qquad\text{versus}\qquad H_a:\text{at least one }\beta_j\neq 0 \]
| Source | df | SS | MS |
|---|---|---|---|
| Regression | \(p-1\) | \(\mathrm{SS_{reg}}=\mathrm{SS_{tot}}-\ssres\) | \(\mathrm{SS_{reg}}/(p-1)\) |
| Residual | \(n-p\) | \(\ssres\) | \(\ssres/(n-p)\) |
| Total | \(n-1\) | \(\mathrm{SS_{tot}}\) |
\[ F\ =\ \frac{\mathrm{MS_{reg}}}{\mathrm{MS_{res}}} \ =\ \frac{\mathrm{SS_{reg}}/(p-1)}{\ssres/(n-p)} \ \sim\ F_{p-1,\,n-p}\quad\text{under }H_0 \]
Application: plant growth
Thirty plants receive one of three conditions: control, treatment 1, or treatment 2. The response is dried plant weight.
One-way ANOVA asks whether the population means are equal:
\[ H_0:\mu_{\mathrm{ctrl}}=\mu_{\mathrm{trt1}}=\mu_{\mathrm{trt2}} \]
It compares the separation among the group means with the variation of plants inside each group.
\(g\) treatments, \(n_i\) units on treatment \(i\), \(N = \sum_i n_i\).
\[ y_{ij} \ = \ \mu + \tau_i + \e_{ij}, \qquad j = 1, \ldots, n_i \]
This is \(\yv = \Xv\betav + \epsilonv\) with \(\betav = (\mu, \tau_1, \ldots, \tau_g)^\top\) and \(\Xv\) an \(N \times (g+1)\) matrix of indicators.
\[ \Xv \ = \ \begin{pmatrix} \mathbf{1}_{n_1} & \mathbf{1}_{n_1} & \mathbf{0} & \cdots & \mathbf{0} \\ \mathbf{1}_{n_2} & \mathbf{0} & \mathbf{1}_{n_2} & \cdots & \mathbf{0} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ \mathbf{1}_{n_g} & \mathbf{0} & \mathbf{0} & \cdots & \mathbf{1}_{n_g} \end{pmatrix} \]
One column for the intercept, then one indicator column per treatment.
For \(g = 3\) with \(n_1 = n_2 = n_3 = 2\), writing \(\yv = \Xv\betav + \epsilonv\) out in full:
\[ \begin{pmatrix} y_{11} \\ y_{12} \\ y_{21} \\ y_{22} \\ y_{31} \\ y_{32} \end{pmatrix} \ = \ \begin{pmatrix} 1 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 \\ 1 & 0 & 0 & 1 \\ 1 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} \mu \\ \tau_1 \\ \tau_2 \\ \tau_3 \end{pmatrix} \ + \ \begin{pmatrix} \e_{11} \\ \e_{12} \\ \e_{21} \\ \e_{22} \\ \e_{31} \\ \e_{32} \end{pmatrix} \]
\(\Xv\) has rank \(g\), not \(g+1\): the intercept column is the sum of the \(g\) treatment columns.
Equivalently, adding \(c\) to \(\mu\) and subtracting \(c\) from every \(\tau_i\) leaves \(\Xv\betav\) unchanged. So \(\Xv^\top\!\Xv\) is singular and \(\hat\betav\) is not unique.
The usual fixes are the constraints from §6: set \(\tau_1 = 0\), or \(\sum_i \tau_i = 0\), or drop \(\mu\) and use cell means.
\[ \R^N \ = \ \underbrace{\mathrm{span}(\mathbf{1})}_{1} \ \oplus \ \underbrace{\mathcal{C}(\Xv) \ominus \mathrm{span}(\mathbf{1})}_{g-1} \ \oplus \ \underbrace{\mathcal{C}(\Xv)^\perp}_{N-g} \]
| Source | df | SS | \(\E[\mathrm{MS}]\) |
|---|---|---|---|
| Treatments | \(g-1\) | \(\sum_i n_i(\bar y_{i\cdot} - \bar y_{\cdot\cdot})^2\) | \(\sigma^2 + \dfrac{\sum_i n_i \tau_i^2}{g-1}\) |
| Residual | \(N-g\) | \(\sum_{i,j}(y_{ij} - \bar y_{i\cdot})^2\) | \(\sigma^2\) |
| Total | \(N-1\) | \(\sum_{i,j}(y_{ij} - \bar y_{\cdot\cdot})^2\) |
Under \(H_0 : \tau_1 = \cdots = \tau_g\), the two mean squares have the same expectation and
\[ F \ = \ \frac{\mathrm{MS_{treatments}}}{\mathrm{MS_{residual}}} \ \sim \ F_{g-1,\,N-g} \]
Between-group scale is the separation among treatment means; within-group scale is the spread of observations around their own treatment mean.
Every test in this course has the form
\[ H_0 : \Cv\betav = \dv, \qquad \Cv \in \R^{q \times p} \text{ of rank } q, \ \text{rows estimable} \]
| Hypothesis | \(\Cv\) |
|---|---|
| \(\beta_j = 0\) | one row, \(\cv^\top = \ev_j^\top\) |
| All treatments equal | \(g-1\) contrast rows |
| No interaction | the interaction rows |
| Dose response is linear | the curvature contrasts |
Fitting under \(H_0\) means projecting onto the smaller subspace \(\mathcal{C}(\Xv_0) \subset \mathcal{C}(\Xv)\) of dimension \(p - q\), with hat matrix \(\Hv_0\) and residual sum of squares \(\ssres_0\).
For example 1, \(\betav=(\beta_0,\beta_1,\beta_2)^\top\). For examples 2 and 3, \(\betav=(\mu_A,\mu_B,\mu_C)^\top\) contains three treatment means.
| Scientific question | \(\Cv\) | \(\dv\) | Equivalent null hypothesis |
|---|---|---|---|
| 1. Does \(x_2\) contribute after accounting for \(x_1\)? | \(\begin{pmatrix}0&0&1\end{pmatrix}\) | \(0\) | \(H_0:\beta_2=0\) |
| 2. Do two active treatments average to the control? | \(\begin{pmatrix}-1&\tfrac12&\tfrac12\end{pmatrix}\) | \(0\) | \(H_0:\dfrac{\mu_B+\mu_C}{2}=\mu_A\) |
| 3. Are all three treatment means equal? | \(\begin{pmatrix}1&-1&0\\0&1&-1\end{pmatrix}\) | \(\begin{pmatrix}0\\0\end{pmatrix}\) | \(H_0:\mu_A=\mu_B=\mu_C\) |
Each row of \(\Cv\) is one linear restriction. Thus \(q=1\) in examples 1 and 2, while \(q=2\) in example 3.
For \(H_0:\Cv\betav=\dv\), with \(\mathrm{rank}(\Cv)=q\), use a full-rank parameterization and let
\[ \boldsymbol{V}_C=\Cv(\Xv^\top\Xv)^{-1}\Cv^\top. \]
Then
\[ \Cv\hat\betav \sim \mathcal{N}_q\!\left(\Cv\betav,\sigma^2\boldsymbol{V}_C\right), \qquad \frac{ (\Cv\hat\betav-\dv)^\top \boldsymbol{V}_C^{-1} (\Cv\hat\betav-\dv) }{ q\hat\sigma^2 } \sim F_{q,n-p} \quad\text{under }H_0. \]
Scheffé’s extension. In a one-way ANOVA, the same overall \(F\) distribution simultaneously protects every contrast \(\sum_i a_i\mu_i\), even one chosen after seeing the data. Reject \(H_0:\sum_i a_i\mu_i=0\) when
\[ \frac{ \left(\sum_i a_i\bar y_{i\cdot}\right)^2 }{ \hat\sigma^2\sum_i a_i^2/n_i } > (g-1)F_{g-1,N-g;\,1-\alpha}, \qquad \sum_i a_i=0. \]
Be able to write \(\Xv\) for a one-way layout in all three parameterizations of §6, by hand.
Redo the §4 two-sample \(t\)-test with unequal \(n_A, n_B\) of your choosing, and check that \(S_p^2\) still makes sense as a weighted average.
Review estimability and contrasts (Christensen 2011; Searle and Gruber 2016).
Bring the experiment you would like to run.
Two things to carry forward:
\[ \hat\yv = \Hv\yv \qquad\text{and}\qquad \mathrm{Var}(\hat\betav) = \sigma^2\pa{\Xv^\top\!\Xv}^{-1} \]