Reputation: 2738
In glmer, random effects are normally distributed. My research involves non-gaussian random effects distributions. Is there a way to specify a non-gaussian random effects distribution for glmer? I know there can be user-defined links -- I'm hoping there's some similar option for random effects distributions. If not, I'd appreciate insights for how to edit/contribute to lme4 source code to allow for non-gaussian random intercept distributions.
Upvotes: 2
Views: 863
Reputation: 226087
What you want is basically impossible; the machinery of lme4
very strongly depends on a Gaussian distribution (on the link/linear-predictor scale) of the conditional modes.
If I wanted to fit models with non-Gaussian distributions of random effects I would use a Bayesian-toolbox approach (JAGS or Stan, or PyMC ...). Richard McElreath's rethinking package might offer a relatively painless front-end for constructing appropriate Stan models ... For example, the code below assumes a t-distributed rather than a Gaussian random effect and "works" (i.e. runs without errors - I will warn you that it could still be a lot of work to get this to do reliable estimation)
## devtools::install_github("rmcelreath/rethinking")
## also need to install rstan ...
library(lme4)
library(rethinking)
f2 <- alist(
Reaction ~ dnorm( mu , sigma ),
mu <- b0 + b0j[Subject] + b1*Days,
b0j[Subject] ~ dstudent(df, 0 , sigma_group ),
b0 ~ dnorm( 0 , 10 ),
b1 ~ dnorm( 0 , 10 ),
sigma ~ dlnorm( 0 , 1 ),
sigma_group ~ dlnorm( 0 , 1 ),
df ~ dlnorm(5,1)
)
m1 <- map2stan(f2, data=sleepstudy, verbose=TRUE)
Some algorithms have been designed for mixed modeling with non-Gaussian random effects in a more traditional frequentist, optimization-based framework (e.g., Google scholar search on "non-Gaussian random effects"), but I'm not aware of any of them having been implemented in R.
Upvotes: 6