This is the predict()
method for refmodel
objects (returned by
get_refmodel()
or init_refmodel()
). It offers three types of output which
are all based on the reference model and new (or old) observations: Either
the linear predictor on link scale, the linear predictor transformed to
response scale, or the log predictive density.
# S3 method for refmodel
predict(
object,
newdata = NULL,
ynew = NULL,
offsetnew = NULL,
weightsnew = NULL,
type = "response",
...
)
Either a vector of predictions (with the scale depending on argument
type
) or, if !is.null(ynew)
, a vector of log predictive densities
evaluated at ynew
.
An object of class refmodel
(returned by get_refmodel()
or
init_refmodel()
).
Passed to argument newdata
of the reference model's
extract_model_data
function (see init_refmodel()
). Provides the
predictor (and possibly also the response) data for the new (or old)
observations. May also be NULL
(see argument extract_model_data
of
init_refmodel()
). If not NULL
, any NA
s will trigger an error.
If not NULL
, then this needs to be a vector of new (or old)
response values. See section "Value" below.
Passed to argument orhs
of the reference model's
extract_model_data
function (see init_refmodel()
). Used to get the
offsets for the new (or old) observations.
Passed to argument wrhs
of the reference model's
extract_model_data
function (see init_refmodel()
). Used to get the
weights for the new (or old) observations.
Only relevant if is.null(ynew)
. The scale on which the
predictions are returned, either "link"
or "response"
(see
predict.glm()
but note that predict.refmodel()
does not adhere to the
typical R convention of a default prediction on link scale). For both
scales, the predictions are averaged across the posterior draws.
Currently ignored.
Argument weightsnew
is only relevant if !is.null(ynew)
.