predict.refmodel | R Documentation |
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 posterior predictive density.
## S3 method for class 'refmodel'
predict(
object,
newdata = NULL,
ynew = NULL,
offsetnew = NULL,
weightsnew = NULL,
type = "response",
...
)
object |
An object of class |
newdata |
Passed to argument |
ynew |
If not |
offsetnew |
Passed to argument |
weightsnew |
Passed to argument |
type |
Usually only relevant if |
... |
Currently ignored. |
Argument weightsnew
is only relevant if !is.null(ynew)
.
In case of a multilevel reference model, group-level effects for new group
levels are drawn randomly from a (multivariate) Gaussian distribution. When
setting projpred.mlvl_pred_new
to TRUE
, all group levels from newdata
(even those that already exist in the original dataset) are treated as new
group levels (if is.null(newdata)
, all group levels from the original
dataset are considered as new group levels in that case).
In the following, N
, C_{\mathrm{cat}}
, and
C_{\mathrm{lat}}
from help topic refmodel-init-get are used.
Furthermore, let C
denote either C_{\mathrm{cat}}
(if
type = "response"
) or C_{\mathrm{lat}}
(if type = "link"
).
Then, if is.null(ynew)
, the returned object contains the reference
model's predictions (with the scale depending on argument type
) as:
a length-N
vector in case of (i) the traditional projection, (ii)
the latent projection with type = "link"
, or (iii) the latent projection
with type = "response"
and object$family$cats
being NULL
;
an N \times C
matrix in case of (i) the augmented-data
projection or (ii) the latent projection with type = "response"
and
object$family$cats
being not NULL
.
If !is.null(ynew)
, the returned object is a length-N
vector of log
posterior predictive densities evaluated at ynew
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.