Learn R Programming

projpred (version 2.0.2)

predict.refmodel: Predict method for reference model objects

Description

Compute the predictions using the reference model, that is, compute the expected value for the next observation, or evaluate the log-predictive density at a given point.

Usage

# S3 method for refmodel
predict(
  object,
  newdata,
  ynew = NULL,
  offsetnew = NULL,
  weightsnew = NULL,
  type = "response",
  ...
)

Arguments

object

The object of class refmodel.

newdata

Matrix of predictor values used in the prediction.

ynew

New (test) target variables. If given, then the log predictive density for the new observations is computed.

offsetnew

Offsets for the new observations. By default a vector of zeros. By default we take the weights from newdata as in the original model. Either NULL or right hand side formulas.

weightsnew

Weights for the new observations. For binomial model, corresponds to the number trials per observation. Has effect only if ynew is specified. By default a vector of ones. By default we take the weights from newdata as in the original model. Either NULL or right hand side formulas.

type

Scale on which the predictions are returned. Either 'link' (the latent function value, from -inf to inf) or 'response' (the scale on which the target y is measured, obtained by taking the inverse-link from the latent value).

...

Currently ignored.

Value

Returns either a vector of predictions, or vector of log predictive densities evaluated at ynew if ynew is not NULL.