Learn R Programming

FlexReg (version 1.1)

plot.flexreg_postpred: Posterior Predictives Plot

Description

Method for plotting the simulated posterior predictive distribution from an object of class `flexreg_postpred`. The plot shows the posterior predictive interval for each statistical unit. Additionally, the mean of the posterior predictives and the values of the observed response (or relative response, in case of binomial data) can be added.

Usage

# S3 method for flexreg_postpred
plot(x, prob = 0.9, p_mean = F, response = NULL, ...)

Arguments

x

an object of class `flexreg_postpred` containing the simulated posterior predictives, usually the result of posterior_predict.

prob

the interval probability for the posterior predictives (default is 0.9).

p_mean

a logical value indicating whether the posterior predictives' mean should be plotted.

response

a numerical vector containing the response (o relative response, in the case of binomial data) to be added to the plot. If NULL, observed values are not plotted.

...

additional arguments. Currently not used.

Examples

Run this code
if (FALSE) {
data("Reading")
dataset <- Reading
FB <- flexreg(accuracy ~ iq, dataset, n.iter=1000)
pp <- posterior_predict(FB)
plot(pp)
}

Run the code above in your browser using DataLab