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

  • http://ms.mcmaster.ca/~bolker/misc/private/14-Fox-Chap13.pdf
  • supplementary material
  • B. M. Bolker (2015) (code ASPROMP8)

References

Banta, JA et al. 2010. Oikos 119 (2) (February): 359–369. doi:10.1111/j.1600-0706.2009.17726.x. http://onlinelibrary.wiley.com/doi/10.1111/j.1600-0706.2009.17726.x/abstract.

Barr, DJ et al. 2013. Journal of Memory and Language 68 (3) (April): 255–278. doi:10.1016/j.jml.2012.11.001. http://www.sciencedirect.com/science/article/pii/S0749596X12001180.

Bates, D et al. 2015. arXiv:1506.04967 [stat] (June). http://arxiv.org/abs/1506.04967.

Biswas, K. 2015. Master’s thesis, McMaster University. https://macsphere.mcmaster.ca/bitstream/11375/17272/2/M.Sc_Thesis_final_Keya_Biswas.pdf.

Bolker, BM. 2015. In Ecological statistics: Contemporary theory and application, ed by. Gordon A. Fox et al. Oxford University Press.

Booth, JG et al. 1999. Journal of the Royal Statistical Society. Series B 61 (1): 265–285. doi:10.1111/1467-9868.00176.

Breslow, NE. 2004. In Proceedings of the second seattle symposium in biostatistics: Analysis of correlated data, ed by. Danyu Y. Lin et al., 1–22. Springer.

Ives, AR et al. 2006. Ecological Applications 16 (1): 20–32. http://www.esajournals.org/doi/pdf/10.1890/04-0702.

McKeon, CS et al. 2012. Oecologia 169 (4): 1095–1103. doi:10.1007/s00442-012-2275-2.

Ponciano, JM et al. 2009. Ecology 90 (2) (February): 356–362. http://www.jstor.org/stable/27650990.

Rousset, F et al. 2014. Ecography: no–no. doi:10.1111/ecog.00566. http://onlinelibrary.wiley.com/doi/10.1111/ecog.00566/abstract.

Rue, H et al. 2009. Journal of the Royal Statistical Society, Series B 71 (2): 319–392.

Sung, YJ et al. 2007. The Annals of Statistics 35 (3) (July): 990–1011. doi:10.1214/009053606000001389. http://projecteuclid.org/euclid.aos/1185303995.