Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fortify

add information to data based on a fitted model


Description

fortify adds information to data based on a fitted model; getData retrieves data as specified in the data argument

Usage

fortify.merMod(model, data = getData(model),
    ...)
## S3 method for class 'merMod'
getData(object)

Arguments

model

fitted model

object

fitted model

data

original data set, if needed

...

additional arguments

Details

  • fortify is defined in the ggplot2 package, q.v. for more details. fortify is not defined here, and fortify.merMod is defined as a function rather than an S3 method, to avoid (1) inducing a dependency on ggplot2 or (2) masking methods from ggplot2. This feature is both experimental and semi-deprecated, as the help page for fortify itself says: “Rather than using this function, I now recommend using the broom package, which implements a much wider range of methods. fortify may be deprecated in the future.” The broom.mixed package is recommended for mixed models in general.

  • getData is a bare-bones implementation; it relies on a data argument having been specified and the data being available in the environment of the formula. Unlike the functions in the nlme package, it does not do anything special with na.action or subset.

Examples

fm1 <- lmer(Reaction~Days+(1|Subject),sleepstudy)
  names(fortify.merMod(fm1))

lme4

Linear Mixed-Effects Models using 'Eigen' and S4

v1.1-26
GPL (>= 2)
Authors
Douglas Bates [aut] (<https://orcid.org/0000-0001-8316-9503>), Martin Maechler [aut] (<https://orcid.org/0000-0002-8685-9910>), Ben Bolker [aut, cre] (<https://orcid.org/0000-0002-2127-0443>), Steven Walker [aut] (<https://orcid.org/0000-0002-4394-9078>), Rune Haubo Bojesen Christensen [ctb] (<https://orcid.org/0000-0002-4494-3399>), Henrik Singmann [ctb] (<https://orcid.org/0000-0002-4842-3657>), Bin Dai [ctb], Fabian Scheipl [ctb] (<https://orcid.org/0000-0001-8172-3603>), Gabor Grothendieck [ctb], Peter Green [ctb] (<https://orcid.org/0000-0002-0238-9852>), John Fox [ctb], Alexander Bauer [ctb], Pavel N. Krivitsky [ctb, cph] (<https://orcid.org/0000-0002-9101-3362>, shared copyright on simulate.formula)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.