Package: merTools 1.0.0

merTools: Tools for Analyzing Mixed Effect Regression Models

Provides methods for extracting results from mixed-effect model objects fit with the 'lme4' package. Allows construction of prediction intervals efficiently from large scale linear and generalized linear mixed-effects models. This method draws from the simulation framework used in the Gelman and Hill (2007) textbook: Data Analysis Using Regression and Multilevel/Hierarchical Models.

Authors:Jared E. Knowles [aut, cre], Carl Frederick [aut], Alex Whitworth [ctb]

merTools_1.0.0.tar.gz
merTools_1.0.0.zip(r-4.7)merTools_1.0.0.zip(r-4.6)merTools_1.0.0.zip(r-4.5)
merTools_1.0.0.tgz(r-4.6-any)merTools_1.0.0.tgz(r-4.5-any)
merTools_1.0.0.tar.gz(r-4.7-any)merTools_1.0.0.tar.gz(r-4.6-any)
merTools_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
merTools/json (API)
NEWS

# Install 'merTools' in R:
install.packages('merTools', repos = c('https://jknowles.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/jknowles/mertools/issues

Pkgdown/docs site:https://jknowles.github.io

Datasets:
  • hsb - A subset of data from the 1982 High School and Beyond survey used as examples for HLM software

On CRAN:

Conda:

12.61 score 102 stars 2 packages 915 scripts 8.1k downloads 18 mentions 32 exports 60 dependencies

Last updated from:e6060e0656. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK254
source / vignettesOK247
linux-release-x86_64OK269
macos-release-arm64OK156
macos-oldrel-arm64OK147
windows-develOK229
windows-releaseOK210
windows-oldrelOK205
wasm-releaseOK151

Exports:averageObsbglmerModListblmerModListdrawexpectedRankfastdispFEsimfindFormFunsglmerModListICClmerModListmodelFixedEffmodelInfomodelRandEffStatsplotFEsimplotREimpactplotREsimpredictIntervalrandomObsREcorrExtractREextractREimpactREmarginsREquantileREsdExtractREsimRMSE.merModshinyMersubBootsuperFactorthetaExtractwiggle

Dependencies:abindarmbackportsblmebootbroombroom.mixedclicodacodetoolscpp11digestdplyrfarverforcatsforeachfurrrfuturegenericsggplot2globalsgluegtableisobanditeratorslabelinglatticelifecyclelistenvlme4magrittrMASSMatrixminqamvtnormnlmenloptrparallellypillarpkgconfigpurrrR6rbibutilsRColorBrewerRcppRcppEigenRdpackreformulasrlangS7scalesstringistringrtibbletidyrtidyselectutf8vctrsviridisLitewithr

An Introduction to merTools

Rendered frommerToolsIntro.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-05-30
Started: 2015-05-27

Exploring Contextual Effects with merTools

Rendered fromcontextual_effects.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-05-30
Started: 2026-05-29

Analyzing Imputed Data with Multilevel Models and merTools

Rendered fromimputation.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-05-30
Started: 2017-07-10

Using merTools to Marginalize Over Random Effect Levels

Rendered frommarginal_effects.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-05-30
Started: 2019-05-11

Prediction Intervals from merMod Objects

Rendered fromUsing_predictInterval.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-05-30
Started: 2015-05-21

Validating predictInterval() against brms

Rendered frombrms_validation.Rmdusingknitr::rmarkdownon May 30 2026.

Last update: 2026-05-30
Started: 2026-05-30

Readme and manuals

Help Manual

Help pageTopics
Find the average observation for a merMod objectaverageObs
Collapse a dataframe to a single average rowcollapseFrame
Draw a single observation out of an object matching some criteriadraw draw.merMod
Calculate the expected rank of random coefficients that account for uncertainty.expectedRank
Find link function familyfamlink
fastdisp: faster display of model summariesfastdisp fastdisp.merMod fastdisp.merModList
Simulate fixed effects from merMod 'FEsim' simulates fixed effects from merMod object posterior distributionsFEsim
Extract all warning msgs from a merMod objectfetch.merMod.msgs
'findFormFuns' used by averageObs to calculate proper averagesfindFormFuns
Extract fixed-effects estimates for a merModListfixef.merModList
Identify if a merMod has weightshasWeights
A subset of data from the 1982 High School and Beyond survey used as examples for HLM softwarehsb
Calculate the intraclass correlation using mixed effect modelsICC
Apply a multilevel model to a list of data framesbglmerModList blmerModList glmerModList lmerModList
merModList S3 ClassmerModList merModList-class
Extract averaged fixed effect parameters across a list of merMod objectsmodelFixedEff
Extract model information from a merModmodelInfo
Extract data.frame of random effect statistics from merMod ListmodelRandEffStats
Extract all warning msgs from a merMod objectplot_sim_error_chks
Plot the results of a simulation of the fixed effectsplotFEsim
Plot the impact of grouping-factor levels on predictionsplotREimpact
Plot the results of a simulation of the random effectsplotREsim
Predict from merMod objects with a prediction intervalpredictInterval
Summarize a merMod listprint.merModList
Print the summary of a merMod listprint.summary.merModList
Select a random observation from model datarandomObs
Extract random-effects estimates for a merModListranef.merModList
Extract the correlations between the slopes and the intercepts from a modelREcorrExtract
Extracts random effectsREextract
Calculate the weighted mean of fitted values for various levels of random effect terms.REimpact
Calculate the predicted value for each observation across the distribution of the random effect terms.REmargins
Identify group level associated with RE quantileREquantile
Extract the standard deviation of the random effects from a merMod objectREsdExtract
Simulate random effects from merMod 'REsim' simulates random effects from merMod object posterior distributionsREsim
Estimate the Root Mean Squared Error (RMSE) for a lmerModRMSE.merMod
Clean up variable names in data framessanitizeNames
Set up parallel environmentsetup_parallel
Launch a shiny app to explore your merMod interactivelyshinyMer
Randomly reorder a dataframeshuffle
Simulate random‑effect contributions for all grouping factorssimulate_random_effects
Remove attributes from a data.framestripAttributes
Bootstrap a subset of an lme4 modelsubBoot
Subset a data.frame using a list of conditionssubsetList
Print the results of a merMod listsummary.merModList
Create a factor with unobserved levelssuperFactor
Extract theta parameters from a merMod modelthetaExtract
Extract the variances and correlations for random effects from a merMod listVarCorr.merModList
Assign an observation to different valueswiggle