Learn R Programming

FlexReg (version 1.1)

posterior_predict.flexreg: Posterior Predictive

Description

The function takes an object of class `flexreg` and generates values from the posterior predictive distribution.

Usage

# S3 method for flexreg
posterior_predict(model, newdata = NULL)

Value

An object of class `flexreg_postpred` containing a matrix with the simulated posterior predictions. Each column refers to a statistical unit to predict.

Arguments

model

an object of class `flexreg`, usually the result of flexreg or flexreg_binom.

newdata

an optional data frame containing variables with which to predict. If omitted, the fitted values are used.

Details

The function generates values from the posterior predictive distribution, which is the distribution of a future outcome given the observed data. In case of binomial data, the posterior predictive distribution is computed for the relative response y/n.

References

Gelman, A.; Carlin, J. B.; Stern, H. S. and Rubin, D. B. (2014), Bayesian Data Analysis, 3th edition. Chapman and Hall/CRC. doi:10.1201/b16018

Ascari, R., Migliorati, S. (2021). A new regression model for overdispersed binomial data accounting for outliers and an excess of zeros. Statistics in Medicine, 40(17), 3895--3914. doi:10.1002/sim.9005

#' Migliorati, S., Di Brisco, A. M., Ongaro, A. (2018) A New Regression Model for Bounded Responses. Bayesian Analysis, 13(3), 845--872. doi:10.1214/17-BA1079

Di Brisco, A. M., Migliorati, S., Ongaro, A. (2020) Robustness against outliers: A new variance inflated regression model for proportions. Statistical Modelling, 20(3), 274--309. doi:10.1177/1471082X18821213

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