lme4
tidiers will soon be deprecated in broom
and there is no ongoing
development of these functions at this time. lme4
tidiers are being
developed in the broom.mixed
package, which is not yet on CRAN.
# S3 method for merMod tidy(x, effects = c("ran_pars", "fixed"), scales = NULL, ran_prefix = NULL, conf.int = FALSE, conf.level = 0.95, conf.method = "Wald", ...) # S3 method for merMod augment(x, data = stats::model.frame(x), newdata, ...) # S3 method for merMod glance(x, ...)
x | An object of class |
---|---|
effects | A character vector including one or more of "fixed" (fixed-effect parameters), "ran_pars" (variances and covariances or standard deviations and correlations of random effect terms) or "ran_modes" (conditional modes/BLUPs/latent variable estimates) |
scales | scales on which to report the variables: for random effects, the choices are ‘"sdcor"’ (standard deviations and correlations: the default if |
ran_prefix | a length-2 character vector specifying the strings to use as prefixes for self- (variance/standard deviation) and cross- (covariance/correlation) random effects terms |
conf.int | whether to include a confidence interval |
conf.level | confidence level for CI |
conf.method | method for computing confidence intervals (see |
... | extra arguments (not used) |
data | original data this was fitted on; if not given this will attempt to be reconstructed |
newdata | new data to be used for prediction; optional |
All tidying methods return a data.frame
without rownames.
The structure depends on the method chosen.
tidy
returns one row for each estimated effect, either
with groups depending on the effects
parameter.
It contains the columns
the group within which the random effect is being estimated: "fixed"
for fixed effects
level within group (NA
except for modes)
term being estimated
estimated coefficient
standard error
t- or Z-statistic (NA
for modes)
P-value computed from t-statistic (may be missing/NA)
predicted values
residuals
predicted values with no random effects
the square root of the estimated residual variance
the data's log-likelihood under the model
the Akaike Information Criterion
the Bayesian Information Criterion
deviance
These methods tidy the coefficients of mixed effects models, particularly
responses of the merMod
class
When the modeling was performed with na.action = "na.omit"
(as is the typical default), rows with NA in the initial data are omitted
entirely from the augmented data frame. When the modeling was performed
with na.action = "na.exclude"
, one should provide the original data
as a second argument, at which point the augmented data will contain those
rows (typically with NAs in place of the new columns). If the original data
is not provided to augment()
and na.action = "na.exclude"
, a
warning is raised and the incomplete rows are dropped.
if (FALSE) { if (require("lme4")) { # example regressions are from lme4 documentation lmm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) tidy(lmm1) tidy(lmm1, effects = "fixed") tidy(lmm1, effects = "fixed", conf.int=TRUE) tidy(lmm1, effects = "fixed", conf.int=TRUE, conf.method="profile") tidy(lmm1, effects = "ran_modes", conf.int=TRUE) head(augment(lmm1, sleepstudy)) glance(lmm1) glmm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), data = cbpp, family = binomial) tidy(glmm1) tidy(glmm1, effects = "fixed") head(augment(glmm1, cbpp)) glance(glmm1) startvec <- c(Asym = 200, xmid = 725, scal = 350) nm1 <- nlmer(circumference ~ SSlogis(age, Asym, xmid, scal) ~ Asym|Tree, Orange, start = startvec) tidy(nm1) tidy(nm1, effects = "fixed") head(augment(nm1, Orange)) glance(nm1) } }