Skip to main content
1 of 4
David Marx
  • 7.1k
  • 2
  • 30
  • 46

Your prior is a full distribution, not just 10 values. If were using a $N(5,1)$ prior, I would probably plot it by evaluating the density function at a large number of values over small increments in the neighborhood of its mode, like this:

xv = seq(0,10,.01)
plot(xv, dnorm(xv, 5, 1), type='l')

Generally, I'd be more likely to plot the posterior using a kernel density estimate than as a histogram, but the histogram certainly has its place (especially if you aren't able to sample a lot of values from the posterior). In any event, there's very little excuse to plot a simple prior like yours using a histogram since we know its shape exactly.

David Marx
  • 7.1k
  • 2
  • 30
  • 46