View source: R/OverdispersionTest.R
| Overdispersion.test | R Documentation |
Poisson-based methods for the determination of no/lowest observed (adverse) effect concentrations from count data, such as CPCAT, rely on the assumption that the variance of the counts equals their mean. Ecotoxicological count data frequently violate this assumption (overdispersion), which invalidates the subsequent inference. Overdispersion.test provides a model-agnostic pre-test that checks this assumption before a method is chosen. Model-agnostic means that no generalised linear model has to be specified and fitted beforehand; the Poisson distribution is only used as a reference framework. The test statistic is the mean of the squared within-group Poisson-standardised residuals, T = mean(z^2) with z_ij = (y_ij - mu_i) / sqrt(mu_i), which is scale-invariant and therefore comparable across designs with different mean levels. The decision threshold is not taken from an asymptotic distribution but is calibrated by Monte Carlo simulation for the design at hand, which makes the test applicable to the small sample sizes that are typical for ecotoxicological studies. The test is one-sided: only unusually large values of T lead to rejection, i.e. underdispersion is not detected. For details on the structure of the input data, please refer to the dataset 'Daphnia.counts' provided alongside this package.
Overdispersion.test(
groups,
counts,
alpha = 0.05,
bootstrap.runs = 5000,
pretest.mode = "tolerant",
tolerance.factor = 2,
use.fixed.random.seed = NULL,
include.zero.groups = FALSE,
zero.group.mean = 0.5,
show.output = TRUE
)
groups |
Group vector |
counts |
Vector with count data |
alpha |
Significance level of the one-sided test |
bootstrap.runs |
Number of Monte Carlo simulations used to calibrate the decision threshold |
pretest.mode |
Reference distribution used for the calibration (use either "tolerant" or "strict"). The "strict" option calibrates against a pure Poisson distribution, i.e. any deviation from variance = mean is treated as overdispersion. The "tolerant" option calibrates against a negative binomial distribution with a tolerated variance-to-mean ratio (see tolerance.factor), i.e. mild deviations from the Poisson assumption are accepted. The tolerant option reflects that Poisson-based methods are robust against small deviations and that a threshold is needed above which they are not. |
tolerance.factor |
Tolerated variance-to-mean ratio used if pretest.mode = "tolerant". The negative binomial size parameter is set to k = mu / (tolerance.factor - 1), which yields a variance of mu * tolerance.factor, i.e. the tolerance factor is exactly the tolerated variance-to-mean ratio. Must be greater than 1. Ignored if pretest.mode = "strict". |
use.fixed.random.seed |
Use fixed seed, e.g. 123, for reproducible results. If NULL no seed is set. |
include.zero.groups |
Include treatment groups whose counts are all zero. Such groups carry no information on dispersion and are excluded by default. |
zero.group.mean |
Value that replaces a group mean of zero in the denominator of the standardised residuals. Only used if include.zero.groups = TRUE. |
show.output |
Show/hide output |
The observed statistic T is compared with a critical value c_alpha that is obtained as the (1 - alpha) quantile of the Monte Carlo null distribution of T. Overdispersion is reported if T > c_alpha. In addition, a one-sided Monte Carlo p-value is calculated as (1 + number of simulated values >= T) / (1 + bootstrap.runs).
Note on the interpretation of T: under a Poisson distribution with KNOWN group means the expected value of z^2 is 1. Since the group means are estimated from the same data, the expected value of T is (N - G) / N, with N being the number of observations and G the number of groups, i.e. it is smaller than 1 and depends on the design (for example 0.833 for six replicates per group). This does not affect the validity of the test, because the Monte Carlo calibration uses exactly the same estimator and the bias therefore cancels out. To provide a directly interpretable quantity, the results additionally report the bias-corrected dispersion ratio phi = T * N / (N - G), which has an expected value of 1 under a Poisson distribution and can be read as a pooled variance-to-mean ratio. Since phi is a strictly monotone transformation of T, the test decision is identical in both scales.
The decision of this test should not be used as the only criterion for the choice of a method. The statistic reduces the mean-variance relationship of a whole data set to a single number, and at the replication typical for ecotoxicological studies the test has limited power, so that a non-significant result is weak evidence for the Poisson assumption rather than proof of it. The group statistics returned alongside the test report the mean, the variance and the variance-to-mean ratio of every treatment, and these should be inspected as well, together with a graphical check such as a plot of the group variances against the group means with the identity line added, or of the residuals against the fitted values. A single treatment with a markedly deviating variance-to-mean ratio is visible there but may well leave the pooled statistic non-significant.
Groups containing fewer than two observations are excluded, since a within-group dispersion cannot be evaluated for them.
R object with results, group statistics and information from the overdispersion test
Daniels, B.; Kotschik, P.; Walter-Rohde, S.; Graeff, T. (2026): When Counts Deviate: Robust Overdispersion Diagnostics for Ecotoxicity Data. Poster presented at the 36th SETAC Europe Annual Meeting, 17-21 May 2026, Maastricht, The Netherlands.
Cameron, A. C.; Trivedi, P. K. (1990): Regression-based tests for overdispersion in the Poisson model. In: Journal of Econometrics, 1990, 46(3), p. 347-364, https://doi.org/10.1016/0304-4076(90)90014-K
Lehmann, R.; Bachmann, J.; Maletzki, D.; Polleichtner, C.; Ratte, H.; Ratte, M. (2016): A new approach to overcome shortcomings with multiple testing of reproduction data in ecotoxicology. In: Stochastic Environmental Research and Risk Assessment, 2016, 30(3), p. 871-882, https://doi.org/10.1007/s00477-015-1079-4
Daphnia.counts # example data provided alongside the package
# Test for overdispersion, tolerating a variance-to-mean ratio of up to 2
Overdispersion.test(groups = Daphnia.counts$Concentration,
counts = Daphnia.counts$Number_Young,
alpha = 0.05,
bootstrap.runs = 500, # Caution: low number of simulations for testing
pretest.mode = "tolerant",
tolerance.factor = 2,
use.fixed.random.seed = 123, #fixed seed for reproducible results
show.output = TRUE)
# Test against a pure Poisson distribution, i.e. without tolerating any deviation
Overdispersion.test(groups = Daphnia.counts$Concentration,
counts = Daphnia.counts$Number_Young,
alpha = 0.05,
bootstrap.runs = 500, # Caution: low number of simulations for testing
pretest.mode = "strict",
use.fixed.random.seed = 123, #fixed seed for reproducible results
show.output = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.