Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(a) Suppose X1, X2, ..., X5 N(u, 2 = 10). Treat o2 = 10 as the known constant. We want to test Ho :
(a) Suppose X1, X2, ..., X5 " N(u, 2 = 10). Treat o2 = 10 as the known constant. We want to test Ho : u = 10 vs H1 : u # 10 at level of significance, a. (i) Write a function in R that generates 5 samples from a N(u = 10, 02 = 10) distribution . evaluates the likelihood function at u = 10 (save it under the name L_theta0) . evaluates the likelihood function at u = x (save it under the name L_thetal) . calculates and returns -2 * log(L_theta0/L_thetal) (ii) Run this function using the replicate() command (or something similar ) and save the output under the name LRT_vec. (iii) Plot a density histogram using LRT_vec. code hint: use hist() with options freq=FALSE, breaks=100. (iv) Overlay a Xar=1) density curve on top of this histogram. code hint: generate 100000 random samples from a X(af=1), use denisty () and lines()(b) (we Will repeat the process of part(a) but with a different distribution here) Suppose X1, X2, ..., X5 \"351 Pois()\\). We want to test H0 : A = 10 vs H1 : A 75 10 at level of signicance, (1. (i) Write a function in R that . generates 5 samples from a Pois()\\ = 10) distribution - evaluates the likelihood function at A = 10 (save it under the name L_theta0) . evaluates the likelihood function at A = :E (save it under the name L_theta1) . calculates and returns 2 >1: log(L_theta0/L_theta1) (ii) Run this function (100000 times) using the replicateo command (or something similar) and save the output under the name LRT_'uec. (iii) Plot a density histogram using LRT_'uec. (iv) Overlay a Xifdf) density curve on top of this histogram. (c) In both parts (a) and (b), your histograms should match(almost if not completely) with the X?df=1) density. Make a brief comment on What role you expect the sample size to play in the closeness of the histograms and the density. (In other words, do you expect these type of closeness irrespective of the value of n?)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started