CPCAT: CPCAT

View source: R/CPCAT.R

CPCATR Documentation

CPCAT

Description

When conducting statistical tests with multiple treatments, such as a control group and increasing concentrations of a test substance, ANOVA and parametric post-hoc tests (e.g. Dunnett's test) are commonly used. However, these tests require the assumptions of homogeneous variances and normally distributed data. For count data (e.g. counts of animals), these assumptions are typically violated, as the data are usually Poisson-distributed. Additionally, multiple testing using post-hoc tests can lead to alpha-inflation. To address these issues, CPCAT was proposed by Lehmann et al. (2016). CPCAT has two components. The first is the Closure Principle (CP) developed by Bretz et al. (2010), which aims to eliminate alpha-inflation. CP applies a stepwise approach to identify at which concentration effects begin to occur. The second part of CPCAT is the actual significance test, CAT (Computational Approach Test; introduced by Chang et al., 2010), which uses a test based on the Poisson distribution rather than a parametric test based on normal distribution assumptions. For details on the structure of the input data, please refer to the dataset 'Daphnia.counts' provided alongside this package.

Usage

CPCAT(
  groups,
  counts,
  control.name = NULL,
  bootstrap.runs = 10000,
  hampel.threshold = NULL,
  use.fixed.random.seed = NULL,
  get.contrasts.and.p.values = FALSE,
  show.output = TRUE,
  overdispersion.test = NULL
)

Arguments

groups

Group vector

counts

Vector with count data

control.name

Character string with control group name (optional)

bootstrap.runs

Number of bootstrap runs

hampel.threshold

Threshold for Hampel identifier (measure for over-/underdispersion). If NULL (default) the Hampel identifier is not evaluated. The Hampel identifier compares the difference between variance and mean of each treatment group with a fixed threshold. Since the sampling variability of this difference grows proportionally to the mean while the threshold does not, the identifier becomes increasingly sensitive at higher count levels and flags Poisson-distributed data as overdispersed far too often (Daniels et al., 2026). It is therefore switched off by default and should only be enabled for backward compatibility or at low count levels. See Overdispersion.test for a scale-invariant alternative, and note that no dispersion diagnostic should be relied on alone: the data should always be inspected graphically as well, for example by plotting the group variances against the group means together with the identity line.

use.fixed.random.seed

Use fixed seed, e.g. 123, for reproducible results. If NULL no seed is set.

get.contrasts.and.p.values

Get each row of the contrast matrices evaluated

show.output

Show/hide output

overdispersion.test

Add the result of the overdispersion pre-test to the information object. Use NULL or FALSE (default) to switch the pre-test off, TRUE to run it with the default settings of Overdispersion.test, or a named list with any of the arguments alpha, bootstrap.runs, pretest.mode, tolerance.factor, use.fixed.random.seed, include.zero.groups and zero.group.mean to control it. Enabling the pre-test does not change the CPCAT results, since the state of the random number generator is restored afterwards.

Value

R object with results and information from CPCAT calculations

References

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.

Bretz, F.; Hothorn, T.; Westfall, P. (2010): Multiple comparisons using R. 1st Edition, Chapman and Hall/CRC, New York

Chang, C.-H.; Pal, N.; Lin, J.-J. (2010): A Note on Comparing Several Poisson Means. In: Commun. Stat. Simul. Comput., 2010, 39(8), p. 1605-1627, https://doi.org/10.1080/03610918.2010.508860

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

Examples

Daphnia.counts	# example data provided alongside the package

# Test CPCAT
CPCAT(groups = Daphnia.counts$Concentration,
	 counts = Daphnia.counts$Number_Young,
	 control.name = NULL,
	 bootstrap.runs = 10000,
	 use.fixed.random.seed = 123,  #fixed seed for reproducible results
	 get.contrasts.and.p.values = FALSE,
	 show.output = TRUE)

# Test CPCAT and add the overdispersion pre-test to the information object
CPCAT(groups = Daphnia.counts$Concentration,
	 counts = Daphnia.counts$Number_Young,
	 control.name = NULL,
	 bootstrap.runs = 1000,	# Caution: low number of bootstrap runs for testing
	 use.fixed.random.seed = 123,  #fixed seed for reproducible results
	 get.contrasts.and.p.values = FALSE,
	 show.output = TRUE,
	 overdispersion.test = list(bootstrap.runs = 500, use.fixed.random.seed = 123))

qountstat documentation built on Oct. 16, 2026, 5:09 p.m.

Related to CPCAT in qountstat...