merTools is an R package that is designed to make working with multilevel models from lme4, particularly large models with many random effects, fast and easy. With merTools you can generate prediction intervals that incorporate various components of uncertainty (fixed effect, random effect, and model uncertainty), you can get the expected rank of individual random effect levels (a combination of magnitude and precision of the estimate) and you can explore the substantive effect of variables in the model using a Shiny application interactively!
Recently, we've updated the package to significantly improve performance and accuracy. You can get it on CRAN now.
Below are some updates from the NEWS.md. To learn more check out the package development on GitHub. You can also read previous a previous blog entry discussing the package and its uses.
merTools 0.3.0
- Improve handling of formulas. If the original
merMod
has functions specified in the formula, thedraw
andwiggle
functions will check for this and attempt to respect these variable transformations. Where this is not possible a warning will be issued. Most common transformations are respected as long as the the original variable is passed untransformed to the model. - Change the calculations of the residual variance. Previously residual variance was used to inflate both the variance around the fixed parameters and around the predicted values themselves. This was incorrect and resulted in overly conservative estimates. Now the residual variance is appropriately only used around the final predictions
- New option for
predictInterval
that allows the user to return the full interval, the fixed component, the random component, or the fixed and each random component separately for each observation - Fixed a bug with slope+intercept random terms that caused a miscalculation of the random component
- Add comparison to
rstanarm
to the Vignette - Make
expectedRank
output moretidy
like and allow function to calculate expected rank for all terms at once- Note, this breaks the API by changing the names of the columns in the output of this function
- Remove tests that test for timing to avoid issues with R-devel JIT compiler
- Remove
plyr
and replace withdplyr
- Fix issue #62
varList
will now throw an error if==
is used instead of=
- Fix issue #54
predictInterval
did not included random effects in calculations whennewdata
had more than 1000 rows and/or user specifiedparallel=TRUE
. Note: fix was to disable the.paropts
option forpredictInterval
... user can still specify for temporary backward compatibility but this should be either removed or fixed in the permanent solution. - Fix issue #53 about problems with
predictInterval
when only specific levels of a grouping factor are innewdata
with the colon specification of interactions - Fix issue #52 ICC wrong calculations ... we just needed to square the standard deviations that we pulled