# Homework 8

Due 2020-11-04 by midnight.

- Study Chapters 27-29 of Shotts.
- Study Chapter 19
- Consider sampling from the distribution porpotional to the function f(x) = sin(x) - 2x/pi between 0 and pi/2. Generate samples from f using the Acceptance Rejection Sampling. BONUS: Can you use an opimization routine to determine the smallest value of c that ensures c g(x) > f(x) for all x?
- Consider sampling from the distribution proportional to f(x) = k exp(-|x-10|*c(x)) where c(x) = 2 is x<10 and c(x)=0.5 if x>=10.
- Use numerical integration between 0 and 30 to determine an approximate value for k.
- Write a function that uses the Metropolis-Hastings Algorithm to generate
samples from the distribution. Have the function take a tuning parameter
as an argument.
- Check all diagnostics to ensure that the sampling is performed correctly.

- Revisit the Ted Williams data set from the last homework.
Using Exp(1) priors for both parameters in the beta distribution, draw samples from
the posterior distribution of a and b given the data using a Bayesian update.
Create a credible interval for a and b. Compare this to the result generated for
MLEs in the previous assignment.
- Submit this homework by committing the necessary files (including any
data files) in the appropriate directory and pushing to your central Git
repository. Remember to not commit files that are easily reproducible.