[R-sig-ME] Prediction variance for GLMM

d@luedecke m@ili@g off uke@de d@luedecke m@ili@g off uke@de
Sun Jan 6 00:16:14 CET 2019


Dear Michael,

For prediction intervals (in contrast to confidence intervals), I recommend
Ben Bolker's FAQ on GLMM's:
http://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#predictions-andor-con
fidence-or-prediction-intervals-on-predictions

The example in the FAQ is for models with simple random effects structures.
The idea is to add the random effect variances as additional source of
uncertainty to get prediction intervals. In another context, Ben Bolker has
drafted a function to compute r-squared values for GLMM's, based on the
paper from Nakagawa et al. 2017, where Ben used a proposal from Johnson et
al. to compute the mean random effect variance for models with more complex
random effects structures. I'm using the same approach to compute
predictions with prediction intervals from glmer() or glmmTMB(), in my
package "ggeffects", which computes marginal effects for many different
models. 

See below four examples, each one for glmer() and glmmTMB(), where
predictions condition on fixed effects only, and where prediction intervals
also take the uncertainty of random effects into account. The current code
may only work in the GitHub-version from ggeffects, but a CRAN submission is
planned within the next days. You find more details at
http://strengejacke.github.io/ggeffects.

Best
Daniel


library(lme4)
library(glmmTMB)
library(ggeffects)

m1 <- glmer(
  cbind(incidence, size - incidence) ~ period + (1 | herd),
  data = cbpp, 
  family = binomial
)

m2 <- glmmTMB(
  cbind(incidence, size - incidence) ~ period + (1 | herd),
  data = cbpp, 
  family = binomial
)

ggpredict(m1, "period")
#> 
#> # Predicted probabilities of cbind(incidence, size - incidence) 
#> # x = period 
#> 
#>  x predicted std.error conf.low conf.high
#>  1     0.198     0.231    0.136     0.280
#>  2     0.084     0.307    0.048     0.143
#>  3     0.074     0.327    0.040     0.132
#>  4     0.048     0.425    0.022     0.105
#> 
#> Adjusted for:
#> * herd = 0 (population-level)
#> Standard errors are on link-scale (untransformed).

ggpredict(m2, "period")
#> 
#> # Predicted probabilities of cbind(incidence, size - incidence) 
#> # x = period 
#> 
#>  x predicted std.error conf.low conf.high
#>  1     0.198     0.232    0.135     0.280
#>  2     0.084     0.310    0.047     0.144
#>  3     0.074     0.330    0.040     0.132
#>  4     0.048     0.430    0.021     0.106
#> 
#> Adjusted for:
#> * herd = NA (population-level)
#> Standard errors are on link-scale (untransformed).

ggpredict(m1, "period", type = "re")
#> 
#> # Predicted probabilities of cbind(incidence, size - incidence) 
#> # x = period 
#> 
#>  x predicted std.error conf.low conf.high
#>  1     0.198     0.682    0.061     0.485
#>  2     0.084     0.712    0.022     0.270
#>  3     0.074     0.721    0.019     0.247
#>  4     0.048     0.770    0.011     0.187
#> 
#> Adjusted for:
#> * herd = 0 (population-level)
#> Standard errors are on link-scale (untransformed).

ggpredict(m2, "period", type = "re")
#> 
#> # Predicted probabilities of cbind(incidence, size - incidence) 
#> # x = period 
#> 
#>  x predicted std.error conf.low conf.high
#>  1     0.198     0.683    0.061     0.485
#>  2     0.084     0.713    0.022     0.270
#>  3     0.074     0.722    0.019     0.248
#>  4     0.048     0.773    0.011     0.188
#> 
#> Adjusted for:
#> * herd = NA (population-level)
#> Standard errors are on link-scale (untransformed).

Nakagawa S, Johnson P, Schielzeth H (2017) The coefficient of determination
R2 and intra-class correlation coefficient from generalized linear
mixed-effects models revisted and expanded. J. R. Soc. Interface 14. doi:
10.1098/rsif.2017.0213

Johnson PC, O'Hara RB. 2014. Extension of Nakagawa & Schielzeth's R2GLMM to
random slopes models. Methods Ecol Evol, 5: 944-946. (doi:
10.1111/2041-210X.12225)




-----Ursprüngliche Nachricht-----
Von: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> Im
Auftrag von Levine, Michael
Gesendet: Samstag, 5. Januar 2019 19:49
An: r-sig-mixed-models using r-project.org
Cc: 'Jiexin Duan' <duan32 using purdue.edu>
Betreff: [R-sig-ME] Prediction variance for GLMM

Dear all,


I would like to ask the following question. Is it possible to obtain
prediction variances for GLMMs in the package lme4 , based e.g. on the
function glmer? I know that it is possible to do it with "pure" GLM's but I
don't see any options for GLMM's.  I realize there is a problem there
because such a variance can be defined in several different ways...


Let me know and thanks a lot in advance!


Yours,

Michael Levine
Associate Professor, Statistics

Department of Statistics
Purdue University
250 North University Street
West Lafayette, IN 47907 USA

email: mlevins using purdue.edu
Phone: +1-765-496-7571
Fax:   +1-765-494-0558
URL:   www.stat.purdue.edu/~mlevins

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

--

_____________________________________________________________________

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Marya Verdel
_____________________________________________________________________

SAVE PAPER - THINK BEFORE PRINTING



More information about the R-sig-mixed-models mailing list