Purpose: to compare drjacoby infered posterior distribution against the exact analytical solution for a very simple model.
A vector of data x
drawn from a normal distribution with
unknown mean mu
and known variance of 1.0.
Likelihood and prior:
Parameters dataframe:
## Warning: In subset.data.frame(mcmc$output, phase = "sampling") :
## extra argument 'phase' will be disregarded
# calculate analytical solution
x <- seq(-1, 1, l = 1001)
fx <- dnorm(x, mean = mean(data_list$x), sd = sqrt(1/n))
# histogram and overlay analytical
hist(mu_draws, breaks = seq(-1, 1, 0.01), probability = TRUE, col = "black")
lines(x, fx, col = 2, lwd = 4)