Description
Question 5.1: Grid Approximation Poisson
We have the data Y with 0, 0, 1, 2, 0, 2, 2, 1 and 1. It follows a Poisson distribution. We can de ne a simple model for estimating the lambda parameter of the Poisson distribution as:
Y P oisson(lambda) [likelihood]
lambda U niform(0; 4) [prior]
Use a grid approximation to compute the posterior for the model with the data Y . Produce a plot to visualize the posterior. Submit the plot and the code.
Question 5.2: Grid Approximation Normal
We have the data Y with 0:3120639, 0:5550930, 0:2493114 and 0:9785842. It follows a normal distribution. We can de ne a simple model for estimating the mu (mean) and sigma (sd) parameter of the normal distribution as:
Y N ormal(mu; sigma) [likelihood]
mu U niform(0; 1) [prior]
sigma U niform(0; 1) [prior]
Use grid approximation to compute the posterior for the model with the data Y . Produce a plot of the posterior.
Submit the plot and the code.
Hint: Since you are approximating a two-dimensional parameter space, the grid approximation algorithm and the plot changes. Find a way to depict the posterior with respect to both parameters in a single plot.