Going full Bayesian with mixed effects regression models

Interesting new statistics tools

HLP/Jaeger lab blog

Thanks to some recently developed tools, it’s becoming very convenient to do full Bayesian inference for generalized linear mixed-effects models. First, Andrew Gelman et al. have developed Stan, a general-purpose sampler (like BUGS/JAGS) with a nice R interface which samples from models with correlated parameters much more efficiently than BUGS/JAGS. Second, Richard McElreath has written glmer2stan, an R package that essentially provides a drop-in replacement for the lmer command that runs Stan on a generalized linear mixed-effects model specified with a lme4-style model formula.

This means that, in many cases, you simply simply replace calls to (g)lmer() with calls to glmer2stan():

library(glmer2stan)
library(lme4)
lmer.fit <- glmer(accuracy ~ (1|item) + (1+condition|subject) + condition, 
                  data=data, family='binomial')
summary(lmer.fit)
library(glmer2stan)
library(rstan)
stan.fit <- glmer2stan(accuracy ~ (1|item) + (1+condition|subject) + condition, 
                       data=data, family='binomial')
stanmer(stan.fit)

There’s the added benefit that you get a sample from the full, joint posterior distribution of the model…

View original post 482 more words

Advertisements

Additions to the Website

We have added new info to our website, see e.g.:

https://experimentalfieldlinguistics.wordpress.com/links/recording-equipment-websites/

https://experimentalfieldlinguistics.wordpress.com/links/institutes/researchers/

https://experimentalfieldlinguistics.wordpress.com/readings/experimental-linguistic-studies-in-the-field/