1 Computation Questions: Homework #5
1 Computation Questions: Homework #5
Homework #5
This is the homework for week 5. The due date is 11:59 p.m., October 20. Late submission will
automatically result in “0” grade. Please include codes for the program part in your submission.
1 Computation Questions
(Question1): (20 points)
For a public opinion poll for a close presidential election, let p denote the proportion of voters
who favor candidate A. How large a sample should be taken if we want the maximum error
of the estimate of p to be equal to
(a) 0.03 with approximate 95% confidence?
(b) 0.02 with approximate 95% confidence?
(c) 0.03 with approximate 90% confidence?
(d) Since we do not know p in practice, please provide a valid upper bound for the number
of samples in aforementioned problems which is independent of p. (Hint: you may use the
fact that
p p+1−p 1
p(1 − p) ≤ = .
2 2
)
(Question2): (30 points)
Suppose X1 , X2 , · · · , Xn are i.i.d. Poisson random variables with parameter λ, i.e.,
λk
P rob(X1 = k) = exp(−λ) for k ≥ 0.
k!
1 Pn
Recall the MLE for λ is n i=1 Xi .
1
(c) Provide a valid estimator for the Fisher information. You do not need to prove the
consistency of your estimator.
(d) Derive an 1 − α confidence interval for a.
2 Programming Questions
(20 points)
Implement the following experiment using Jupyter or R:
i. Generate X1 , · · · , Xn satisfying Bernoulli distribution with parameter p = 0.3 and n = 40.
ii. Plot the 95% confidence interval for p, i.e.,
" p p #
pb(1 − pb) pb(1 − pb)
pb − √ × z2.5% , pb − √ × z97.5% ,
n n
Please ignore the x–axis and y–axis scales of the figure, we just show what the result should look
like.