calibrationTest {surveillance} | R Documentation |
Calibration Tests for Poisson or Negative Binomial Predictions
Description
The implemented calibration tests for Poisson or negative binomial
predictions of count data are based on proper scoring rules and
described in detail in Wei and Held (2014).
The following proper scoring rules are available:
Dawid-Sebastiani score ("dss"
),
logarithmic score ("logs"
),
ranked probability score ("rps"
).
Usage
calibrationTest(x, ...)
## Default S3 method:
calibrationTest(x, mu, size = NULL,
which = c("dss", "logs", "rps"),
tolerance = 1e-4, method = 2, ...)
Arguments
x |
the observed counts. All involved functions are vectorized and also accept matrices or arrays. |
mu |
the means of the predictive distributions for the
observations |
size |
either |
which |
a character string indicating which proper scoring rule to apply. |
tolerance |
absolute tolerance for the null expectation and variance of
|
method |
selection of the |
... |
unused (argument of the generic). |
Value
an object of class "htest"
,
which is a list with the following components:
method |
a character string indicating the type of test
performed (including |
data.name |
a character string naming the supplied |
statistic |
the |
parameter |
the number of predictions underlying the test, i.e., |
p.value |
the p-value for the test. |
Note
If the gsl package is installed, its implementations of the
Bessel and hypergeometric functions are used when calculating the null
expectation and variance of the rps
.
These functions are faster and yield more accurate results (especially
for larger mu
).
Author(s)
Sebastian Meyer and Wei Wei
References
Wei, W. and Held, L. (2014): Calibration tests for count data. Test, 23, 787-805.
Examples
mu <- c(0.1, 1, 3, 6, pi, 100)
size <- 0.1
set.seed(1)
y <- rnbinom(length(mu), mu = mu, size = size)
calibrationTest(y, mu = mu, size = size) # p = 0.99
calibrationTest(y, mu = mu, size = 1) # p = 4.3e-05
calibrationTest(y, mu = 1, size = size) # p = 0.6959
calibrationTest(y, mu = 1, size = size, which = "rps") # p = 0.1286