View source: R/overdispersion.R
overdisp_fun | R Documentation |
Test for overdispersion and compute overdispersion factor for generalized linear mixed models.
overdisp_fun(model)
quasi_table(
model,
ctab = coef(summary(model)),
phi = overdisp_fun(model)["ratio"]
)
model |
a model fitted using a generalized linear mixed model family without
an independent scale parameter, i.e. |
Two functions overdisp_fun
and quasi_table
are adapted from the
from the
GLMM FAQ
by Ben Bolker.
quasi_table()
: display coefficient table with standard errors adjusted for overdispersion
library(lme4)
library(spida2)
set.seed(123)
zd <- expand.grid(plate = 1:100) #treat = c('A','B'), batch = 1:10, plate = 1:5)
zd <- within(zd,
{
treat <- plate %% 2 + 1
batch <- plate %% 10 + 1
eta <- rnorm(10)[batch]+ 0 * rnorm(100) + 5 * (treat == 2)
eta_od <- rnorm(10)[batch]+ rnorm(100) + 5 * (treat == 2)
count <- rpois(nrow(zd), exp(eta))
count_od <- rpois(nrow(zd), exp(eta_od))
}
)
fit <- glmer(count ~ treat + (1|batch), zd, family = 'poisson')
fit_od <- glmer(count_od ~ treat + (1|batch), zd, family = 'poisson')
summary(fit)
summary(fit_od)
overdisp_fun(fit)
overdisp_fun(fit_od)
quasi_table(fit)
quasi_table(fit_od)
wald(fit)
wald(fit_od)
wald(fit_od, overdispersion = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.