Please use D2L to turn in both the PDF output and your R Markdown file.
Sketch out the steps for a Gibbs sampler algorithm.
Simulating data is a key step in verifying your algorithms are working correctly. This will be more apparent as we start studying sophisticated hierarchical models.
Simulate 100 observations from a standard normal distribution and plot a histogram of your data.
Select and state prior distributions for \(\theta\) the mean of the normal distribution and \(\sigma^2\) the variance (or alternatively you may parameterize your model using the precision term).
Implement a Gibbs sampler to simulate from the joint posterior distribution \(p(\theta,\sigma^2|y_1, \dots, y_{100})\). Create a plot of the joint posterior distribution.
Plot trace plots and histograms of the marginal posterior distributions for \(\theta\) and \(\sigma^2\). Include the true values on these figures. Comment on the figures.
Use your MCMC samples to create a posterior predictive distribution. Compare the data and your posterior predictive distribution using a QQ plot qqnorm()
. Comment on the figure.