Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please using Rstudio do it, thank you very much 3. Define th=(1:500)/50, L=length(th) and B=1000. Also define noncoverage.mle=noncoverage. bayes=0 Perform a double loop: at the
please using Rstudio do it, thank you very much
3. Define th=(1:500)/50, L=length(th) and B=1000. Also define noncoverage.mle=noncoverage. bayes=0 Perform a double loop: at the i-th iteration of the outer loop define matrices mle.matematrix(0,1,2) and bayes.matematrix(0,1,2); perform the inner loop: at the j-th iteration of the inner loop generate a pseudo-random sample x of size n=4 from an exponential distribution with rate th[i]; 2. obtain mle-based and Bayes intervals (with C=1.5), saving them in the j-th row of mle.mat and bayes.mat respectively; save in the i-th element of noncoverage.mle the number of times the mle-based interval did not cover th[i]; similarly for the Bayes interval in bayes.mat; Convert the counts in the noncoverage vectors to proportions. Plot (as lines) these proportions against th (red for the mle-based, blue for Bayes). Add an informative heading and legend. 3. Define th=(1:500)/50, L=length(th) and B=1000. Also define noncoverage.mle=noncoverage. bayes=0 Perform a double loop: at the i-th iteration of the outer loop define matrices mle.matematrix(0,1,2) and bayes.matematrix(0,1,2); perform the inner loop: at the j-th iteration of the inner loop generate a pseudo-random sample x of size n=4 from an exponential distribution with rate th[i]; 2. obtain mle-based and Bayes intervals (with C=1.5), saving them in the j-th row of mle.mat and bayes.mat respectively; save in the i-th element of noncoverage.mle the number of times the mle-based interval did not cover th[i]; similarly for the Bayes interval in bayes.mat; Convert the counts in the noncoverage vectors to proportions. Plot (as lines) these proportions against th (red for the mle-based, blue for Bayes). Add an informative heading and legendStep 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