4
$\begingroup$

I've recently begun running some multilevel/hierarchical models. Initially I was using rstan/rstanarm, but then switched to the lme4 package.

Is the difference between these two packages only in the use of Bayesian priors (as in rstan) or not, as in lme4?

$\endgroup$
  • 3
    $\begingroup$ Stan is used to perform a Bayesian analysis, lme4 is used to perform a frequentist analysis. $\endgroup$ – Glen Jun 8 '18 at 19:47
  • 2
    $\begingroup$ This question is a little too broad and/or opinion-based as written. lme4 and rstanarm are fitting essentially the same models, in different statistical frameworks (as @Glen says). Unless you have a more specific question in mind, this boils down to "are [frequentist methods] effective for [statistical analysis], or should [Bayesian methods] be used instead?", which is not an easily answerable question. $\endgroup$ – Ben Bolker Jun 8 '18 at 20:03
  • $\begingroup$ Glen's comment appears correct since looking more at the functions in each package, I'm just going to narrow down the question in case anyone else has it. $\endgroup$ – Edward Tyler Jun 8 '18 at 20:06
11
$\begingroup$

lme4 is fully frequentist, while rstanarm is fully Bayesian. That means there are more differences than just whether a prior is used. For example:

  • rstanarm reports marginal medians of the posterior density for each parameter, while lme4 reports maximum likelihood estimates (approximately analogous to the maximum a posteriori (MAP) estimator, or mode of the posterior distribution, given uninformative priors - but see this CV answer for discussion of why this is a loose analogy)
  • rstanarm reports posterior intervals based on quantiles of the marginal posterior distribution (not the more classical highest posterior density intervals), lme4 reports Wald standard errors or likelihood profile confidence intervals
  • diagnostics and convergence checking procedures are radically different.

For what it's worth,

  • brms, also based on Stan, implements a broad class of GLMMs (somewhat broader than rstanarm, I think)
  • MCMCglmm implements a broad class of Bayesian mixed models (based on older MCMC approaches rather than Hamiltonian MC)
  • the blme package implements a partly Bayesian approach to mixed models that allows for weakly or strongly informative priors, but reports MAP estimates (it builds on lme4's technology)
  • the R-INLA package (not on CRAN) uses integrated nested Laplace approximations; it also allows priors and returns MAP estimates
| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.