11 May 2016

Acknowledgments

  • lme4: Doug Bates, Martin M├Ąchler, Steve Walker
  • Data: Josh Banta, Adrian Stier, Sea McKeon, David Julian, Jada-Simone White
  • \($\): NSERC (Discovery), SHARCnet

Examples and definitions

(Generalized) linear mixed models

(G)LMMs: a statistical modeling framework incorporating:

  • combinations of categorical and continuous predictors,
    and interactions
  • (some) non-Normal responses
    (e.g. binomial, Poisson, and extensions)
  • (some) nonlinearity
    (e.g. logistic, exponential, hyperbolic)
  • non-independent (grouped) data

Coral predation (McKeon et al. 2012)

Glycera cell survival (D. Julian unpubl.)

Plant response to fertilization & herbivory (Banta et al. 2010)

Technical definition

\[ \begin{split} \underbrace{Y_i}_{\text{response}} & \sim \overbrace{\text{Distr}}^{\substack{\text{conditional} \\ \text{distribution}}}(\underbrace{g^{-1}(\eta_i)}_{\substack{\text{inverse} \\ \text{link} \\ \text{function}}},\underbrace{\phi}_{\substack{\text{scale} \\ \text{parameter}}}) \\ \underbrace{{\boldsymbol \eta}}_{\substack{\text{linear} \\ \text{predictor}}} & = \underbrace{{\boldsymbol X}{\boldsymbol \beta}}_{\substack{\text{fixed} \\ \text{effects}}} + \underbrace{{\boldsymbol Z}{\boldsymbol b}}_{\substack{\text{random} \\ \text{effects}}} \\ \underbrace{{\boldsymbol b}}_{\substack{\text{conditional} \\ \text{modes}}} & \sim \text{MVN}({\boldsymbol 0},\underbrace{\Sigma({\boldsymbol \theta})}_{\substack{\text{variance-} \\ \text{covariance} \\ \text{matrix}}}) \end{split} \]

What are random effects?

A method for …

  • accounting for among-individual, within-block correlation
  • compromising between
    • complete pooling (no among-block variance)
    • fixed effects (large among-block variance)
  • handling levels selected at random from a larger population
  • sharing information among levels (shrinkage estimation)
  • estimating variability among levels
  • allowing predictions for unmeasured levels

Random-effect myths

  • levels of random effects must always be sampled at random
  • a complete sample cannot be treated as a random effect
  • random effects are always a nuisance variable
  • you can't say anything about the predictions of a random effect
  • you should always use a random effect no matter how few levels you have

Estimation

Maximum likelihood estimation

  • Best fit is a compromise between two components
    (consistency of data with fixed effects and conditional modes; consistency of random effect with RE distribution)
  • Goodness-of-fit integrates over conditional modes

%

Shrinkage: conditional modes

Estimation methods

  • deterministic: various approximate integrals (Breslow 2004)
    • Penalized quasi-likelihood, Laplace, Gauss-Hermite quadrature (Biswas 2015)
      best methods needed for large variance, small clusters
    • flexibility and speed vs. accuracy
  • stochastic (Monte Carlo): frequentist and Bayesian (Booth et al. 1999,Sung et al. (2007),Ponciano et al. (2009))
    • usually slower, more finicky, but flexible and accurate

Estimation: coral example

Inference

Wald tests

  • typical results of summary()
  • exact for ANOVA, regression:
    approximation for GLM(M)s
  • fast
  • approximation is sometimes awful (Hauck-Donner effect)

Likelihood ratio tests

  • better than Wald, but still have two problems:
    • "denominator degrees of freedom'' (when estimating scale parameter)
    • for GLMMs, distributions are approximate anyway (Bartlett corrections)
    • Kenward-Roger correction? (Stroup 2014)
  • Profile confidence intervals: expensive/fragile

Parametric bootstrapping

  • fit null model to data
  • simulate "data" from null model
  • fit null and working model, compute likelihood difference
  • repeat to estimate null distribution
  • should be OK but ??? not well tested
    (assumes estimated parameters are "sufficiently" good)

Bayesian inference

  • If we have a good sample from the posterior distribution (Markov chains have converged etc.) we get most of the inferences we want for free by summarizing the marginal posteriors
  • post hoc Bayesian methods: use deterministic/frequentist methods to find the maximum, then sample around it

Confidence intervals

formula formats

  • fixed: fixed-effect formula
  • random: random-effect formula (in lme4, combined with fixed)
    • simplest: 1|g, single intercept term
    • nested: 1|g1/g2
    • random-slopes: x|g
    • independent terms: (1|g)+(x+0|g) or (x||g)
  • lme: weights, correlation for heteroscedasticity and residual correlation
  • MCMCglmm: options for variance structure

On beyond lme4

  • basic
    • nlme (lme)
    • MCMCglmm
    • inference/tests: lmerTest, afex, pbkrtest
      (car, lsmeans, effects, multcomp)
    • blme (Bayesian regularization)
    • gamm4 (additive models)
    • pretty output: broom, dotwhisker, pixiedust
  • advanced/specialized
    • glmmADMB, glmmTMB: zero-inflated and other distributions
    • brms, rstanarm: interfaces to Stan
    • INLA: spatial and temporal correlations

Challenges &
open questions

On beyond R

  • Julia: MixedModels package
  • SAS: PROC MIXED, NLMIXED
  • AS-REML
  • Stata (GLLAMM, xtmelogit)
  • AD Model Builder; Template Model Builder
  • HLM, MLWiN
  • MCMC: JAGS, Stan, rethinking package

Challenges

  • Small clusters: need AGQ/MCMC
  • Small numbers of clusters: need finite-size corrections
    (Kenward-Roger/parametric bootstrap/MCMC)
  • Simpler inference: importance sampling, quantiles, MCMC?
  • Small data sets: issues with singular fits
    Barr et al. (2013) vs. Bates et al. (2015)
  • Big data: speed, storage, parallelization
  • Model diagnosis
  • Confidence intervals accounting for uncertainty in variances

See also: ecostats chapter example; NCEAS modeling examples; BMB mixed models repo, including GLMM FAQ

Spatial and temporal correlations

  • Sometimes blocking takes care of non-independence …
  • but sometimes there is temporal or spatial correlation within blocks
  • … also phylogenetic … (Ives et al. 2006)
  • "G-side" vs. "R-side" effects
  • tricky to implement for GLMMs,
    but new possibilities on the horizon (Rue et al. 2009; Rousset et al. 2014) (INLA, spaMM); lme4ord package
  • CAR, SAR, Moran eigenvectors … ?
  • additive models?

Next steps

  • Complex random effects:
    regularization, model selection, penalized methods (lasso/fence)
  • Flexible correlation and variance structures
  • Flexible/nonparametric random effects distributions
  • hybrid & improved MCMC methods
  • Reliable assessment of out-of-sample performance

Sales pitch