Question: (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

(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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!