1 Computation Questions: Homework #10
1 Computation Questions: Homework #10
Homework #10
This is the homework for week 11. The due date is 11:59 p.m., December 8. Late submission will
automatically result in “0” grade. Please include codes for the program part in your submission.
1 Computation Questions
(Question1): (35 points) Suppose data X1 , X2 , · · · , Xn are i.i.d. normal N (µ, σ 2 ) random variables
with µ unknown and σ 2 known. Suppose we want to test the hypothesis
H0 : µ ≥ µ0 versus H1 : µ < µ0 ,
supµ≥µ0 L(µ)
≤c
supµ∈R L(µ)
write down the formula of the P-value. Similarly, suppose we want to test the hypothesis
1
(Question3): (45 points) Suppose we have a set of observations (xi1 , xi2 , · · · , xip , Yi ), assuming
that it satisfies a linear model
Xp
Yi = xij βj + ϵi where ϵi ∼ N (0, σ 2 ) and σ is known.
j=1
2 Programming Questions
(40 points)
i. Generate i.i.d. data (Xi , Yi ) for i = 1, 2, · · · , n, where Xi ∼ N (0, 1), Yi = Xi ×0.5+0.1+ϵi ,
and ϵi ∼ N (0, 1). Estimate β0 and β1 using the formula in Question 2. Report the estimated
β0 and β1 .
ii. Repeat step i. for 200 times, and plot a histogram for βb0 and βb1 .
iii. Suppose we want to test the hypothesis
H0 : βb1 = 0 versus H1 : βb1 < 0.
Implement the procedure for calculating P-value. Repeat this step for 200 times, plot the
histogram of this P-value.