Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2: In this problem, we revisit the example that we worked on in class about Kevin Mitchell's batting average, and we imagine that it

image text in transcribedimage text in transcribedimage text in transcribed
Problem 2: In this problem, we revisit the example that we worked on in class about Kevin Mitchell's batting average, and we imagine that it is 1988 now! Assuming that the outcomes of Kevin Mitdiell's hits are independent, the number of his home runs. call it X, has the following distribution: X ~ btomialw), where 9 denotes the probability that Kevin Mitchell makes a home run at a single try and N is the numberof times at bat {trials}. We aim to obtain a distribution for his probability of making a home run, assuming that we have only observed him in his rst 10 games ofthe season where he was at bat 44 times, and he had made 4 home runs. What will be different than what we did in class is that we will use a different prior for 3. Specifically, we use the following shifted and truncated double exponential prior: its): so _s)'2exp{100x |eo.05|}. use 51 1 (r95 + e a) While you can generate values from the truncated exponential density, here, you are to use the Accept-Reject algorithm to generate values from the prior f(0). Specifically, generate values from the Cauchy distribution with location 0.05, and scale 0.01 which has the density 100 g(x) = 7 1 + (100(x - .05))"]' and use these values in an Accept-Reject Algorithm to generate values from f(0). i) [1 point] Determine an optimal a such that g(x)/a is an envelope for the density f. ii) [4 points] Write an R-code to generate 10,000 random values from f. Insert your R code below. iii) [1 point] Draw a density histogram of values you generated and superimpose it by the actual density f. Hint, use the option breaks = 100 for your density histogram and use the R function curve () with the option add = TRUE to superimpose the graph of the function f on top of the histogram. Insert your graph below. b) [5 points] Use the 10,000 values that you generated from the prior in part (a) in a Sampling Importance Resampling (SIR) algorithm to draw 5000 values from the posterior for 0. Insert your R code below. Also, draw a frequency histogram (not a density histogram) of the posterior distribution and insert it below. Use the option breaks = 100 for your histogram.c) [2 points] Using the 5000 values you generated in part (b), approximate the probability that Kevin Michell makes 4 home runs when he is at bat 50 times. Insert your R code and your final solution below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Algebra With Trigonometry

Authors: Charles P McKeague

1st Edition

1483218759, 9781483218755

More Books

Students also viewed these Mathematics questions