STA2002: Probability and Statistics II Fall 2024
Homework #4
This is the homework for week 4. The due date is 11:59 p.m., October 7. Late submission will
automatically result in “0” grade. Please include codes for the program part in your submission.
1 Computation Questions
(Question1): (50 points)
The attendance data is presented in the following table:
Time stamp t attendance
9/10 1 X1 85
9/12 2 X2 73
9/17 NA NA NA
9/19 3 X3 68
9/24 4 X4 56
9/26 5 X5 43
iid
(a) Suppose X1 , X2 , ..., X5 ∼ P ois(λ0 ).
i. Find the maximum likelihood estimate for λ0 .
ii. Suppose the enrollment is 120, find the maximum likelihood estimate for the atten-
dance rate λ0 /120.
(b) Suppose the statistician is interested in the attendance rate, then s/he chooses to work
ind
with the model Xi ∼ Bin(ni , π0 ) for i = 1, 2, ..., where the enrollment n1 = n2 = 100
and ni = 120 for i = 3, 4, 5.
i. Find the maximum likelihood estimator for the attendance rate π0 .
ii. Find the maximum likelihood estimate for the attendance rate π0 .
(c) There seems a declining trend in the attendance data: fewer students took the atten-
dance survey. To estimate the time trend, the modeller works with the following model:
IN D
Xt ∼ P ois(α + βt) for t = 1, 2, ..., 5.
Write down the log likelihood function in terms of α and β.
(Question2): (30 points)
iid
(a) Suppose X1 , ..., Xn ∼ U nif (0, θ), i.e., the density
(
1
if x ∈ (0, θ),
f (x) = θ
0, otherwise.
We already know that the maximum likelihood estimator of θ is θ̂ = max({Xi }ni=1 ).
Derive the CDF and the pdf of θ̂. (Hint: Use the fact that P rob(maxni=1 Xi ≤ x) =
P rob(Xi ≤ x for all i) and the density is the derivative of the cdf.)
1
iid
(b) Suppose Yi ∼ Exp(λ) for i = 1, ..., n, i.e., the density
f (x) = λ exp(−λx), x ≥ 0.
Find the maximum likelihood estimator for λ, and derive its sampling distribution.
(Hint: if X ∼ Gamma(a, b) under the shape-rate parameterization, then 1/X follows
the inverse Gamma distribution (see the wiki link) : 1/X ∼ inv − Gamma(a, b). )
2 Programming Questions
(20 points)
Implement the following experiment using Jupyter or R:
i. Find the maximum likelihood estimate of Q1 (c) numerically.
iid
ii. Simulate Yi ∼ Exp(λ) for i = 1, ..., 100, we choose λ = 2 in this homework. With the pivotal
quantity method, compute a 90% CI for λ. Does your 90% CI contain the true value?
iii. Repeat the experiment of ii for 1000 times. Calculate the coverage rate of your CI.