Announcing a major update to merTools

December 13, 2016

[This article was first published on Data, Evidence, and Policy - Jared Knowles, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 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, the draw and wiggle 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 more tidy 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 with dplyr
  • 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
    when newdata had more than 1000 rows and/or user specified parallel=TRUE.
    Note: fix was to disable the .paropts option for predictInterval … 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 in newdata with the colon specification of
  • Fix issue #52 ICC wrong calculations … we just needed to square the standard
    deviations that we pulled

To leave a comment for the author, please follow the link and comment on their blog: Data, Evidence, and Policy - Jared Knowles. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)