Learn R Programming

FlexReg (version 1.1)

predict.flexreg: Prediction Method for flexreg Objects

Description

Method that computes various types of prediction from objects of class `flexreg`. If the model type is FB or FBB and cluster = T, the function returns also cluster means.

Usage

# S3 method for flexreg
predict(
  object,
  newdata = NULL,
  cluster = F,
  type = "response",
  estimate = "mean",
  q = NULL,
  ...
)

Arguments

object

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.

cluster

logical. If the model is "FB" or "FBB", cluster = T returns the cluster means. By default, cluster = F.

type

a character indicating the type of predictions. Available options are the fitted means of response/relative response (response), the linear predictor (link), the fitted precision parameter phi (precision), the fitted overdispersion parameter theta (overdispersion), and the fitted variances of the response (variance).

estimate

the type of estimate: mean (default), median or quantile.

q

if estimate is quantile, numeric value of probability in (0, 1).

...

additional arguments. Currently not used.

References

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

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

Examples

Run this code
{
data("Reading")
FB <- flexreg(accuracy ~ iq, Reading, type="FB", n.iter=1000)
predict(FB, type="response", cluster=TRUE)
}

Run the code above in your browser using DataLab