plot.posterior_check {bpr} | R Documentation |
This function is a method for class posterior_check
. Plot diagnostic statistics for graphical posterior predictive checks.
## S3 method for class 'posterior_check'
plot(x, ...)
x |
object of class " |
... |
other parameters to be passed through to plotting functions. See Details. |
It is possible to generate additional plots that compare the posterior predictive distribution of a statistics with the observed value.
This is done through the parameter stats
: it is a list with elements the function names of the statistics one wants to compare.
Default is stats = list("mean")
, other possible values are, e.g., "median", "sd", "max" etc.
The function outputs (at least) three plots for graphical posterior predictive check.
The first plot compares the empirical cumulative distribution function (ECDF) with the cumulative distribution function obtained
with samples from the posterior predictive distribution (median and point-wise 95% credible bands).
The second plot compares the distribution of the observed sample with the predictive distribution obtained using the maximum a posteriori (MAP)
estimates of the regression parameters.
The third plot compares the predictive distribution of a statistic (default is the mean) with the observed value of the same statistics,
displayed with a red line.
library(MASS) # load the data set
head(epil)
fit = sample_bpr( y ~ lbase*trt + lage + V4, data = epil,
iter = 1000)
plot(posterior_predictive(fit), stats = c("mean", "sd", "max"))
# plots for posterior predictive check