STAT 135 Lab 2 Confidence Intervals, MLE and The Delta Method
STAT 135 Lab 2 Confidence Intervals, MLE and The Delta Method
February 2, 2015
Confidence Intervals
Confidence intervals
P(Z < qα ) = 1 − α
θ̂n − θ
∼ N(0, 1)
σθ̂n
Recall that
1 − α = P(−qα/2 < Z < qα/2 )
θ̂n −θ
Given that σθ̂n∼ N(0, 1), we have also the result that
!
θ̂n − θ
1 − α = P −qα/2 < < qα/2
σθ̂n
rearranging to make θ the subject, we have
1 − α = P θ̂n − qα/2 σθ̂n < θ < θ̂n + qα/2 σθ̂n
Confidence intervals
We have that
1 − α = P θ̂n − qα/2 σθ̂n < θ < θ̂n + qα/2 σθ̂n
Recall that if we’re looking for a 95% confidence interval (CI), then
we are looking for an interval (a, b) such P(a < θ < b) = 0.95.
(Note that this proof is not rigorous for continuous variables since
they take on specific values with probability 0)
Maximum likelihood estimation
fp (x) = p x (1 − p)1−x
fp (x) = p x (1 − p)1−x
Pn Pn
Step 1: lik(p) = p i=1 Xi (1 − p) i=1 (1−Xi )
Step 2: Calculate the log-likelihood function:
n
X n
X
`(p) = log(lik(p)) = Xi log(p) + (1 − Xi ) log(1 − p)
i=1 i=1
Maximum likelihood estimation - example
fp (x) = p x (1 − p)1−x
Pn Pn
d`(p) i=1 Xi i=1 (1− Xi )
= −
dp p 1−p
Maximum likelihood estimation - example
fp (x) = p x (1 − p)1−x
Pn Pn
d`(p) Xi i=1 (1−Xi )
Step 3: dp = i=1
p − 1−p
Step 4: Set the derivative to 0, and solve for p:
Pn
d`(p) Xi
= 0 =⇒ p̂MLE = i=1 =X
dp n
So the MLE for p where Xi ∼ Bernoulli(p) is just equal to the
sample mean.
Method of Moments (MOM)
Method of Moments
I Confidence interval for θ: calculate a range of values in
which the true value of the parameter θ lies with some
specified probability.
I Maximum likelihood estimator for θ: calculate a single
value which estimates the true value of θ by maximizing the
likelihood function with respect to θ.
I Method of moments estimator for θ: By equating the
theoretical moments to the empirical (sample) moments,
derive equations that relate the theoretical moments to θ.
The equations are then solved for θ.
Suppose X follows some distribution. The kth moment of the
distribution is defined to be
µk = E [X k ] = gk (θ)
E [X ] = 0 × P(X = 0) + 1 × P(X = 1) = p
p̂MOM = X
which is the same as the MLE estimator! (note that this is not
always the case...)
Exercise 2
Exercise – Question 43, Chapter 8 (page 320) from John
Rice
The file gamma-arrivals contains a set of gamma-ray data
consisting of the times between arrivals (interarrival times) of
3,935 photons (units are seconds)
1. Make a histogram of the interarrival times. Does it appear
that a gamma distribution would be a plausible model?
2. Fit the parameters by the method of moments and by
maximum likelihood. How do the estimates compare?
3. Plot the two fitted gamma densities on top of the histogram.
Do the fits look reasonable?
Hint 1: the gamma distribution can be written as
β α α−1 −βx
fα,β (x) = x e
Γ(α)
Hint 2: the MLE for α has no closed-form solution - use:
α̂MLE = 1
The δ-method
The δ-method