hhh4_calibration: Test Calibration of a 'hhh4' Model

Description Usage Arguments Value Author(s) Examples

Description

The calibrationTest-method for "hhh4" models tests the calibration of the model fit, i.e., if the observed counts are from the fitted Poisson/NegBin distribution.

Usage

1
2
3
## S3 method for class 'hhh4'
calibrationTest(x,
                subset = x$control$subset, units = seq_len(x$nUnit), ...)

Arguments

x

an object of class "hhh4".

subset

subset of time points for which to test calibration. Defaults to the subset used for fitting the model.

units

integer or character vector selecting the units for which to test calibration. It indexes colnames(x$stsObj). By default all units are taken into account.

...

arguments passed to calibrationTest.default, e.g., which to select a scoring rule.

Value

an object of class "htest", see calibrationTest.default.

Author(s)

Sebastian Meyer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data("measlesWeserEms")

## fit a hhh4 model
measlesModel <- list(
    end = list(f = addSeason2formula(~0 + ri(type="iid"))),
    ar = list(f = ~1),
    ne = list(f = ~1, weights = W_powerlaw(maxlag = 5)),
    family = "NegBin1")
measlesFit <- hhh4(measlesWeserEms, control = measlesModel)

## plot fitted mean components
plot(measlesFit, units = NULL)

## overall calibration test
calibrationTest(measlesFit) # default is DSS (not suitable for low counts)
calibrationTest(measlesFit, which = "rps")
calibrationTest(measlesFit, which = "logs")
                
## test calibration for the second year in a specific district
calibrationTest(measlesFit, subset = 53:104, units = "03452", which = "rps")

jimhester/surveillance documentation built on May 19, 2019, 10:33 a.m.