Skip to contents

Returns the linear predictor (and conditional response) at each observation in the training data, or the fixed-effects-only prediction at user-supplied newdata (for sites / species not present in the training data we cannot draw the corresponding random effects, so predictions are returned on the population mean).

Usage

# S3 method for class 'gllvmTMB_multi'
predict(
  object,
  newdata = NULL,
  type = c("link", "response"),
  re_form = ~.,
  ...
)

Arguments

object

A gllvmTMB_multi fit.

newdata

Optional new data frame. If NULL, predictions are produced for the training rows.

type

One of "link" (default) or "response".

re_form

Random-effect formula controlling which random effects are included in the predicted linear predictor. Use the default ~ . to include all random effects when predicting on training rows; pass ~ 0 (or NA) to predict the fixed- effects-only / population-mean prediction. For newdata with sites/species not present in the training data the random effects cannot be drawn, so the prediction is fixed-effects-only regardless of re_form.

...

Unused.

Value

A data frame with the original row identifiers plus an est column.