View source: R/predicted_residuals.R
predict.flexreg | R Documentation |
`flexreg`
ObjectsMethod that computes various types of predictions from objects of class `flexreg`
.
## S3 method for class 'flexreg'
predict(
object,
newdata = NULL,
n.new = NULL,
cluster = FALSE,
type = "response",
estimate = "mean",
q = NULL,
...
)
object |
an object of class |
newdata |
an optional |
n.new |
an optional vector containing the total number of trials with which to predict. It must be specified if |
cluster |
a logical (with default |
type |
a character indicating the type of prediction. Available options are: |
estimate |
a character indicating the type of estimate. Available options are |
q |
if |
... |
additional arguments. Currently not used. |
The predict
method computes various types of predictions from objects of class `flexreg`
.
If type = "response"
, the function returns the marginal mean, i.e., \mu
.
In case of models for continuous bounded responses with augmentation, the function returns also the overall mean
q_1+(1-q_0-q_1)\mu
and the probabilities of augmentation q_0
and/or q_1
.
If type = "variance"
, the function returns Var(Y|0<Y<1)
in case of no augmentation and
(1-q_0-q_1)Var(Y|0<Y<1)+q_1^2+(1-q_0-q_1)\mu^2-(q_1+(1-q_0-q_1)\mu)^2
in case of augmentation.
If cluster = TRUE
, for FB and FBB models, the function returns the cluster means (\lambda_1
and \lambda_2
) when type = "response"
and the cluster variances when type = "variance"
.
The option type = "overdispersion"
is available only for beta-binomial and flexible beta-binomial models and returns the fitted overdispersion.
The function returns a data.frame
of different dimensions depending on the type of prediction.
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
Di Brisco, A. M., Migliorati, S. (2020). A new mixed-effects mixture model for constrained longitudinal data. Statistics in Medicine, 39(2), 129–145. doi:10.1002/sim.8406
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
## Not run:
data("Reading")
FB <- flexreg(accuracy.adj ~ iq, data=Reading, type="FB")
predict(FB, type="response", cluster=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.