February 6
To estimate mixed models we need to solve the integral
the integral can be solved analytically
\({\color{blue} \Rightarrow}\) Easy to program \({\color{blue} \Rightarrow}\) Stable algorithms available in most software
\({\color{red} \Rightarrow}\) Much more difficult to program
\({\color{red} \Rightarrow}\) Several solutions available in software, however, many not optimal!!
lme4::glmer()
glmmTMB::glmmTMB()
more flexible than lme4
glmmsr::glmm()
MASS::glmmPQL()
nlme::lme()
data("toenail", package = "HSAUR2")
fm_PQL <- glmmPQL(outcome ~ time * treatment, random = ~ 1 | patientID, data = toenail, family = binomial()) fm_Laplace <- glmer(outcome ~ time * treatment + (1 | patientID), data = toenail, family = binomial()) fm_AGQ15 <- glmer(outcome ~ time * treatment + (1 | patientID), data = toenail, family = binomial(), nAGQ = 15)
cbind(PQL = fixef(fm_PQL), Laplace = fixef(fm_Laplace), AGQ_15 = fixef(fm_AGQ15))
## PQL Laplace AGQ_15 ## (Intercept) -0.74324709 -2.5098642 -1.6473652 ## time -0.29469102 -0.3997340 -0.3924231 ## treatmentterbinafine -0.03480231 -0.3048303 -0.1663130 ## time:treatmentterbinafine -0.10017515 -0.1371352 -0.1371755
data("Salamanders", package = "glmmTMB")
gm_Laplace <- glmmTMB(count ~ spp + mined + (1 | site), ziformula = ~ spp + mined, family = truncated_poisson(), data = Salamanders) gm_AGQ25 <- mixed_model(count ~ spp + mined, random = ~ 1 | site, zi_fixed = ~ spp + mined, family = hurdle.poisson(), data = Salamanders, nAGQ = 25)
cbind(Laplace = fixef(gm_Laplace)$cond, AGQ_25 = fixef(gm_AGQ25))
## Laplace AGQ_25 ## (Intercept) -0.06702286 -3.1900355 ## sppPR -0.52092708 0.1976119 ## sppDM 0.22457540 0.9137361 ## sppEC-A -0.19548416 0.6538284 ## sppEC-L 0.64672238 1.4999425 ## sppDES-L 0.60513701 0.9589269 ## sppDF 0.04602476 0.3426018 ## minedno 1.01446593 0.7137289
Need for adaptive Gaussian quadrature for \({\color{red} > 1}\) random effects
GLMMadaptive::mixed_model()
fixed
a formula for the fixed effectsrandom
a formula for the random effectsdata
a data frame containing the variables to usefamily
a family object specifying the modelfamily = binomial()
family = poisson()
A basic example:
mixed_model(fixed = y ~ time * group, random = ~ time | id, data = DF, family = binomial(), nAGQ = 15)
vignette("GLMMadaptive_basics", package = "GLMMadaptive")
family = negative.binomial()
family = students.t()
family = beta.fam()
family = zi.poisson()
family = zi.negative.binomial()
family = hurdle.poisson()
family = hurdle.negative.binomial()
family = hurdle.lognormal()
family = hurdle.beta.fam()
vignette("ZeroInflated_and_TwoPart_Models", package = "GLMMadaptive")
family
object
vignette("Custom_Models", package = "GLMMadaptive")
summary()
: Estimated coefficients, standard errors & p-valuesanova()
: Hypothesis testing
effectPlotData()
vignette("Methods_MixMod", package = "GLMMadaptive")
vignette("Goodness_of_Fit", package = "GLMMadaptive")
vignette("Multiple_Comparisons", package = "GLMMadaptive")
predict()
method
scoring_rules()
vignette("Methods_MixMod", package = "GLMMadaptive") vignette("Dynamic_Predictions", package = "GLMMadaptive")
confint()
, vcov()
including the sandwich estimatorcoef()
, fixef()
, ranef()
logLik()
, nobs()
fitted()
, residuals()
simulate()
model.matrix()
, model.frame()
terms()
, formula()
, family()
[1] an explanation can be found at: https://stats.stackexchange.com/questions/365907/interpretation-of-fixed-effects-from-mixed-effect-logistic-regression
marginal_coefs()
implements Hedeker's et al. solution with standard errorspenalized
argument of mixed_model()
places a Student's t penalty on the fixed effects[2] an example at: https://stats.stackexchange.com/questions/386553/linear-mixed-model-for-placement-of-nuclear-stress-in-10-word-turns
Thank you for your attention!
These slides are available at: