Onesample#
Download#
One sample problem#
One sample problem#
library(MVT)
data(examScor)
mu_hat = apply(examScor, 2, mean)
mu_hat
Loading required package: fastmatrix
- mechanics
- 38.9545454545455
- vectors
- 50.5909090909091
- algebra
- 50.6022727272727
- analysis
- 46.6818181818182
- statistics
- 42.3068181818182
Suppose I want to test \(H_0:\mu=(50,50,50,50,50)\).
Choosing a statistic#
A natural choice? How should we standardize?
null_mean = rep(50, 5) # mean of 50 on each score
sample_mean = apply(examScor, 2, mean)
T = sum((null_mean-sample_mean)^2)
T
Gaussian model#
Common statistical model:
Density:
MGF:
Assume \(\Sigma>0\) known to start
Likelihood#
Likelihood is
MLE does not depend on \(\Sigma\). Why?
Enough to solve MLE when \(\Sigma=I\)
So,
Testing \(H_0: \mu=\mu_0\)#
Log-likelihood under \(H_0\)
Log-likelihood under \(H_a\)
Difference
Mahalanobis distance#
Given \(\Sigma > 0\)
LRT with \(\Sigma\) known is
Claim: \(Z \sim N(\mu,\Sigma) \implies d_{\Sigma}(Z, \mu) \sim \chi^2_p\)
Unknown \(\Sigma\)#
What if we don’t know \(\Sigma\)?
Univariate case \(p=1\), MLE is
Also, we know \(n \cdot \hat{\sigma}^2_{MLE} \sim \sigma^2 \cdot \chi^2_{n-1}\).
What is analog for \(p>1\)?
Maximizing likelihood#
With \(\Sigma\) unknown, after maximizing over \(\mu\) the (profile) likelihood for \(\Sigma\) is
Introducing precision matrix \(\Theta=\Sigma^{-1}\) likelihood is
Differentiate w.r.t. \(\Theta\) using:
Yields
A sum of squares matrix…
Wishart distribution#
Suppose \(Z_i \overset{IID}{\sim} N(0, \Sigma), 1 \leq i \leq k\)
Claim:
Unbiased estimate: (using fact \(E[Z^TZ]=k\Sigma\))
Analogous to univariate case except sums of squares are matrices!
Estimate of covariance#
Sigma_hat = cov(examScor) # unbiased estimate
Sigma_hat
| mechanics | vectors | algebra | analysis | statistics | |
|---|---|---|---|---|---|
| mechanics | 305.7680 | 127.22257 | 101.57941 | 106.27273 | 117.40491 |
| vectors | 127.2226 | 172.84222 | 85.15726 | 94.67294 | 99.01202 |
| algebra | 101.5794 | 85.15726 | 112.88597 | 112.11338 | 121.87056 |
| analysis | 106.2727 | 94.67294 | 112.11338 | 220.38036 | 155.53553 |
| statistics | 117.4049 | 99.01202 | 121.87056 | 155.53553 | 297.75536 |
Back to test#
W.l.o.g. we take \(\mu_0=0\) below
Under \(H_0\), maximized log-likelihood is
Under \(H_a\), we claim maximized log-likelihood is
LRT is based on
Spring 2025: Initial version had a mistaken \(n\)…
Hotelling’s \(T^2\)#
Suppose \(W \sim \text{Wishart}(k, \Sigma)\), independent of \(Z \sim N(0, \Sigma)\) with \(\mu \in \mathbb{R}^p, \Sigma \in \mathbb{R}^{p \times p } > 0\)
The random variable
As \(k \to \infty\), \(T^2_k \overset{D}{\to} \chi^2_p\).
In one-sample problem, LRT equivalent to
The “right” statistic#
mu_0 = rep(50, 5)
n = nrow(examScor)
T2 = sum((mu_hat - null_mean) * (solve(Sigma_hat / n) %*%
(mu_hat - null_mean)))
T2
Recap of one-sample problem#
Estimation of mean structure – independent of \(\Sigma\). Leads to uncoupled estimation of \(\mu\).
Estimates of \(\Sigma\) involve sum-of-squared error matrix.
Wishart distribution is analog of \(\chi^2\).
Hotelling’s \(T^2\) is the LRT with \(\Sigma\) unknown. Analogous to Student’s \(T\) in univariate case.
While multivariate normal model is likely simplification, using the likelihood provides reasonably intuitive methods and tests.
Distribution theory of LRT can get hairy, though in this case