Plot the posterior probability distribution for a single parameter calculaed using the comb method described by Krushke (2015).

1 |

`x` |
A vector of equally-spaced possible values for the parameter. The range should cover all values of the parameter with non-negligable probability. (To restrict the range dispayed in the plot, use |

`y` |
A vector of probabilities corresponding to the values in |

`credMass` |
the probability mass to include in credible intervals; set to NULL to suppress plotting of credible intervals. |

`plot` |
logical: if TRUE, the posterior is plotted. |

`showMode` |
logical: if TRUE, the mode is displayed instead of the mean. |

`shadeHDI` |
specifies a colour to shade the area under the curve corresponding to the HDI; NULL for no shading. Use |

`...` |
additional graphical parameters. |

The function calculates the Highest Density Interval (HDI). A multi-modal distribution may have a disjoint HDI, in which case the ends of each segment are calculated. No interpolation is done, and the end points correspond to values of the parameter in `x`

; precision will be determined by the resolution of `x`

.

If `plot = TRUE`

, the probability density is plotted together with either the mean or the mode and the HDI.

Returns a matrix with the upper and lower limits of the HDI. If the HDI is disjoint, this matrix will have more than 1 row. It has attributes `credMass`

and `height`

, giving the height of the probability curve corresponding to the ends of the HDI.

Mike Meredith

For details of the HDI calculation, see `hdi`

.

1 2 3 4 5 6 7 8 9 10 11 | ```
# Generate some data:
N <- 0:100
post <- dpois(N, 25)
# Do the plots:
plotComb(N, post)
plotComb(N, post, showMode=TRUE, shadeHDI='pink', xlim=c(10, 50))
# A bimodal distribution:
post2 <- (dnorm(N, 28, 8) + dnorm(N, 70, 11)) / 2
plotComb(N, post2, credMass=0.99, shade='pink')
plotComb(N, post2, credMass=0.80, shade='grey')
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.