Description Usage Arguments Value Author(s) References Examples
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"
).
1 2 3 4 5 6 7 8 9 10 |
x |
a numeric vector of observed counts. All involved functions are vectorized and also accept matrices or arrays. The score functions preserve the dimensions. |
mu |
a numeric vector of 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 finite sum approximation for |
method |
selection of the z-statistic: |
k |
scalar argument controlling the finite sum approximation for the
|
... |
unused (argument of the generic). |
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 z-statistic of the test. |
parameter |
the number of predictions underlying the test, i.e., |
p.value |
the p-value for the test. |
Sebastian Meyer, Michaela Paul, and Wei Wei
Wei, W. and Held, L. (2014): Calibration tests for count data. Test, 23, 787-805.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ## simulated example
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 = 0.1) # p = 0.6959
calibrationTest(y, mu = 1, size = 0.1, which = "rps") # p = 0.1286
## a univariate surveillance time series
data("salmonella.agona")
salmonella <- disProg2sts(salmonella.agona)
## fit a hhh4() model
model <- list(end = list(f = addSeason2formula(~1 + t)),
ar = list(f = ~1),
family = "NegBin1")
fit <- hhh4(salmonella, model)
## do sequential one-step-ahead predictions for the last 5 weeks
pred <- oneStepAhead(fit, nrow(salmonella)-5, type="rolling",
which.start="final", verbose=FALSE)
pred
## test if the model is calibrated
with(pred, calibrationTest(x = observed, mu = pred, size = exp(psi)))
## p = 0.8746
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.