Learn R Programming

itsadug (version 2.0)

get_fitted: Get model all fitted values.

Description

Get model all fitted values.

Usage

get_fitted(model, se = 1.96, rm.ranef = NULL, as.data.frame = FALSE,
  print.summary = getOption("itsadug_print"))

Arguments

model
A gam object, produced by gam or bam.
se
A number to scale the standard error. Defaults to 1.96, resulting in 95% confidence intervals. For 99% confidence intervals use a value of 2.58.
rm.ranef
Logical: whether or not to remove random effects. Default is FALSE. Alternatively a string (or vector of strings) with the name of the random effect(s) to remove.
as.data.frame
Logical: return values as data frame or as vector. Default is FALSE (returning a vector).
print.summary
Logical: whether or not to print a summary of the values selected for each predictor. Default set to the print info messages option (see infoMessages).

Value

  • A data frame with estimates and optionally errors.

See Also

Other Model predictions: get_coefs, get_difference, get_modelterm, get_predictions, get_random

Examples

Run this code
data(simdat)
m1 <- bam(Y ~ Group + s(Time, by=Group)+ s(Subject, bs='re'), data=simdat)

# as.data.frame FALSE and rm.ranef=NULL results in fitted():
all( get_fitted(m1) == fitted(m1) )

# now fitted values without random effects:
all( get_fitted(m1, rm.ranef=TRUE) == fitted(m1) )
head(get_fitted(m1, rm.ranef=TRUE))

# without summary:
infoMessages("off")
head(get_fitted(m1, rm.ranef=TRUE))
infoMessages("on")

Run the code above in your browser using DataLab