Learn R Programming

surveillance (version 1.8-0)

pit: Non-Randomized Version of the PIT Histogram (for Count Data)

Description

See Czado et al. (2009).

Usage

pit(x, pdistr, J = 10, relative = TRUE, ..., plot = list())

Arguments

x
numeric vector representing the observed counts.
pdistr
the predictive CDF for the observations x, i.e., a vectorized function (x, ...). If the observations x have different predictive distributions, these may be provided in a list of the same length as th
J
the number of bins of the histogram.
relative
logical indicating if relative frequency or the density should be plotted.
...
arguments for pdistr. Ignored if pdistr is a list.
plot
a list of arguments for plot.histogram or NULL in which case no plot will be produced.

Value

  • an object of class "histogram" (see hist). It is returned invisibly if a plot is produced.

References

Czado, C., Gneiting, T. & Held, L. (2009): Predictive model assessment for count data. Biometrics, 65, 1254-1261.

Examples

Run this code
## Simulation example of Czado et al. (2009, Section 2.4)
set.seed(321)  # different from the paper
x <- rnbinom(200, mu = 5, size = 2)
op <- par(mfrow=c(1,3))
pit(x, function (x) ppois(x, lambda=5), J=10, relative=TRUE, plot=list(ylim=c(0,3)))
pit(x, function (x) pnbinom(x, mu=5, size=2), J=10, relative=TRUE, plot=list(ylim=c(0,3)))
pit(x, function (x) pnbinom(x, mu=5, size=1), J=10, relative=TRUE, plot=list(ylim=c(0,3)))
par(op)

Run the code above in your browser using DataLab