drizopoulos / GLMMadaptive

GLMMs with adaptive Gaussian quadrature
https://drizopoulos.github.io/GLMMadaptive/
60 stars 14 forks source link
generalized-linear-mixed-models mixed-effects-models mixed-models

GLMMadaptive: Generalized Linear Mixed Models using Adaptive Gaussian Quadrature

R build status CRAN status Download counter Rdoc

Description

GLMMadaptive fits mixed effects models for grouped/clustered outcome variables for which the integral over the random effects in the definition of the marginal likelihood cannot be solved analytically. The package approximates these integrals using the adaptive Gauss-Hermite quadrature rule.

Multiple random effects terms can be included for the grouping factor (e.g., random intercepts, random linear slopes, random quadratic slopes), but currently only a single grouping factor is allowed.

Basic Features

Basic Use

Let y denote a grouped/clustered outcome, g denote the grouping factor, and x1 and x2 covariates. A mixed effects model with y as outcome, x1 and x2 as fixed effects, and random intercepts is fitted with the code:

fm <- mixed_model(fixed = y ~ x1 + x2, random = ~ 1 | g, data = DF,
                  family = poisson())

summary(fm)

In the data argument we provide the data frame DF, which contains the aforementioned variables. In the family argument we specify the distribution of the grouped/clustered outcome conditional on the random effects. To include in the random-effects part intercepts and x1, we update the call to mixed_model() as

gm <- mixed_model(fixed = y ~ x1 + x2, random = ~ x1 | g, data = DF,
                  family = poisson())

summary(gm)

Installation

The development version of the package can be installed from GitHub using the devtools package:

devtools::install_github("drizopoulos/GLMMadaptive")

and with vignettes

devtools::install_github("drizopoulos/GLMMadaptive", build_opts = NULL)

Hex-sticker courtesy of Greg Papageorgiou @gr_papageorgiou.