0% found this document useful (0 votes)
29 views2 pages

1 Computation Questions: Homework #10

Uploaded by

1992714521
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

1 Computation Questions: Homework #10

Uploaded by

1992714521
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

STA2002: Probability and Statistics II Fall 2024

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 ,

with µ0 a known number.


i. Write down the likelihood function L(µ) and log-likelihood function ℓ(µ).
ii. Calculate the maximizer arg maxµ≥µ0 ℓ(µ).
iii. We consider the likelihood ratio test: reject H0 if

supµ≥µ0 L(µ)
≤c
supµ∈R L(µ)

for some constant c. Prove that this is equivalent to: reject H0 if


n
1X
Xi < C
n
i=1

for some constant C (which may not equal c).


iv. Suppose we want to control type-I error to be α, derive the constant C.
(Question2): (35 points) Suppose we have a set of data Y1 , Y2 , · · · , Yn , which are independent and
satisfying
Yi ∼ N (xi β1 + β0 , σ 2 ), where xi is known.

i. Write down the log −likelihood function ℓ(β0 , β1 ).


ii. Derive the maximum likelihood estimator βb0 , βb1 .
iii. Derive the distribution of βb0 and βb1 . Based on this, suppose we want to test the hypothesis

H0 : βb0 = 0 versus H1 : βb0 > 0,

write down the formula of the P-value. Similarly, suppose we want to test the hypothesis

H0 : βb1 = 0 versus H1 : βb1 < 0,

write down the formula of the P-value.

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

In a matrix form, we have


Y = Xβ + ϵ.
i. Write down the log-likelihood function, and prove the MLE for β = (β1 , · · · , βp )⊤ is
equivalent to
(X⊤ X)−1 X⊤ Y.

ii. Suppose we want to test the hypothesis


H0 : β1 = 0 versus H1 : β1 > 0,
derive the formula of the P-value for this test. Hint: β1 = (1, 0, · · · , 0)β.
(Question4): (45 points) Suppose we have observations (xi , Yi ), i = 1, · · · , n. We want to fit a
quadratic curve
Yi = β0 + β1 × xi + β2 × x2i + ϵi , where ϵi ∼ N (0, σ 2 ).
i. Write down the log-likelihood function and derive the MLE for βb (matrix notation).
ii. Assume that σ 2 is known. Derive the 1 − α confidence interval for β1 . (Hint: Your
estimator should be a linear combination of Yi , which has normal distribution).
iii. Suppose we want to test the hypothesis
H0 : β1 = 0, versus H1 : β1 > 0,
establish the P-value of the test.
iii. For the data (6.91, 17.52) (4.32, 22.69) (2.38, 17.61) (7.98, 14.29) (8.26, 10.77) (2.00,
12.87) (3.10, 18.63) (7.69, 16.77) (2.21, 14.97) (3.42, 19.16) (8.18, 11.15) (5.39, 22.41)
(1.19, 7.50) (3.21, 19.06) (5.47, 23.89) (7.35, 16.63) (2.32, 15.09) (7.54, 14.75) (1.27, 10.75)
(7.33,17.42) (8.41, 9.40) (8.72, 9.83) (6.09, 22.33) (5.30, 21.37) (7.30, 17.36), assume σ 2 = 1,
derive the 95% CI for β1 . Does it cover 0? What is the P-value of the test in iii.

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.

You might also like