View source: R/diagnostics_sim.R
| test_dispersion | R Documentation |
Compares the variance of observed data to the variance expected under
the fitted model (via simulation). Ratio > 1 = overdispersion;
< 1 = underdispersion. Equivalent to DHARMa::testDispersion().
test_dispersion(object, ...)
## Default S3 method:
test_dispersion(
object,
observed = NULL,
nsim = 250L,
seed = 123L,
alternative = c("two.sided", "greater", "less"),
...
)
object |
A fitted model with |
... |
Passed to methods. |
observed |
Observed response vector (optional – extracted from fit) |
nsim |
Number of simulations (default 250) |
seed |
Random seed (default 123) |
alternative |
|
An htest object with dispersion ratio and p-value
set.seed(1)
d <- data.frame(x = rnorm(80))
d$y <- rpois(80, exp(0.3 + 0.5 * d$x))
fit <- tulpa(y ~ x, data = d, family = "poisson", mode = "laplace")
test_dispersion(fit, nsim = 50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.