Mathematics 344
Likelihood Ratio Tests
February 10, 2015
Example. A hypothesis test for the parameter λ in the exponential distribution.
iid
X1 , . . . Xn ∼ Exp(λ)
H0
Ha
λ=1
λ 6= 1
P
P
x̄n e−(
e−( xi )
Λ = 1 −(P x /x̄) =
i
e−n
x̄n e
xi )
The form of the test is to reject if Λ is “small.” Often we work with ln Λ.
ln Λ = n + n ln(x̄) −
X
xi = n(1 + ln x̄ − x̄)
loglik <- function(xbar, n) {
n + n * log(xbar) - n * xbar
}
r <- replicate(10000, loglik(mean(rexp(10, 1)), 10))
d <- densityplot(~(-2 * r), xlim = c(0.2, 3), plot.points = F)
plotFun(dchisq(x, 1) ~ x, plot = d, xlim = c(0.2, 3), col = "red", add = T)
qchisq(0.95, 1)
[1] 3.841
qdata(0.95, -2 * r)
p quantile
0.950
3.905
pdata(qchisq(0.95, 1), -2 * r)
[1] 0.9479
0.8
Density
0.6
0.4
0.2
0.0
0.5
1.0
1.5
(−2 * r)
2.0
2.5
© Copyright 2026 Paperzz