Learn R Programming

nauf (version 1.1.0)

predict.nauf.merMod: Predictions from a mixed effects nauf model at new data values.

Description

The predict method for and objects (the results of nauf_glmer, nauf_glmer.nb, and nauf_glmer). It is based on predict.merMod, but currently some options are not supported for nauf models.

Usage

# S3 method for nauf.glmerMod
predict(object, newdata = NULL, newparams = NULL,
  re.form = NULL, ReForm, REForm, REform, terms = NULL, type = c("link",
  "response"), allow.new.levels = FALSE, na.action = na.pass, ...)

# S3 method for nauf.lmerMod predict(object, newdata = NULL, newparams = NULL, re.form = NULL, ReForm, REForm, REform, terms = NULL, type = c("link", "response"), allow.new.levels = FALSE, na.action = na.pass, ...)

Arguments

object

A or .

newdata

A data frame to make predictions on.

newparams, terms, allow.new.levels

Changes to default values are not currently supported and result in an error.

re.form

Formula for random effects to condition on. Currently, only NULL (the default, indicating conditioning on all random effects in the model) and NA or ~ 0 (indicating to use only the fixed effects in the predictions) are supported (i.e. you cannot currently condition on a subset of the random effects).

ReForm, REForm, REform

Older versions of re.form in lme4 which are now deprecated.

type

Whether the predictions should be transformed with the inverse link function.

na.action

Changes from default of na.pass are ignored with a warning.

...

Additional parameters (currently unused and ignored with a warning).

Value

A numeric vector of predicted values.

See Also

predict.merMod, nauf_lmer, nauf_glmer, nauf_glmer.nb, , and .

Examples

Run this code

dat <- plosives
dat$spont[dat$dialect == "Valladolid"] <- NA
sobj <- standardize(intdiff ~ voicing * dialect * spont +
  (1 + voicing * spont | speaker) + (1 + dialect | item), dat)

mod <- nauf_lmer(sobj$formula, sobj$data)
fit <- predict(mod)  # fitted values
preds <- predict(mod, sobj$data)  # predict same data using all ranef
preds_fe <- predict(mod, sobj$data, re.form = NA)  # only use fixef

isTRUE(all.equal(fit, preds))  # TRUE
isTRUE(all.equal(preds, preds_fe))  # FALSE


Run the code above in your browser using DataLab