predict.galamm {galamm}R Documentation

Predictions from a model at new data values

Description

Predictions are given at the population level, i.e., with random effects set to zero. For fitted models including random effects, see fitted.galamm. For mixed response models, only predictions on the scale of the linear predictors is supported.

Usage

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

Arguments

object

An object of class galamm returned from galamm.

newdata

Data from for which to evaluate predictions, in a data.frame. Defaults to "NULL", which means that the predictions are evaluate at the data used to fit the model.

type

Character argument specifying the type of prediction object to be returned. Case sensitive.

...

Optional arguments passed on to other methods. Currently used for models with smooth terms, for which these arguments are forwarded to mgcv::predict.gam.

Value

A numeric vector of predicted values.

See Also

fitted.galamm() for model fits, residuals.galamm() for residuals, and predict() for the generic function.

Other details of model fit: VarCorr(), coef.galamm(), confint.galamm(), deviance.galamm(), factor_loadings.galamm(), family.galamm(), fitted.galamm(), fixef(), formula.galamm(), llikAIC(), logLik.galamm(), nobs.galamm(), print.VarCorr.galamm(), ranef.galamm(), residuals.galamm(), sigma.galamm(), vcov.galamm()

Examples

# Poisson GLMM
count_mod <- galamm(
  formula = y ~ lbas * treat + lage + v4 + (1 | subj),
  data = epilep, family = poisson
)

# Plot response versus link:
plot(
  predict(count_mod, type = "link"),
  predict(count_mod, type = "response")
)

# Predict on a new dataset
nd <- data.frame(lbas = c(.3, .2), treat = c(0, 1), lage = 0.2, v4 = -.2)
predict(count_mod, newdata = nd)
predict(count_mod, newdata = nd, type = "response")


[Package galamm version 0.2.0 Index]