| pit | R Documentation | 
See Czado et al. (2009).
pit(x, ...)
## Default S3 method:
pit(x, pdistr, J = 10, relative = TRUE, ..., plot = list())
| x | numeric vector representing the observed counts. | 
| pdistr | either a list of predictive cumulative distribution functions for
the observations  | 
| J | the number of bins of the histogram. | 
| relative | logical indicating if relative frequency or the density should be plotted.
Due to a historical bug,  | 
| ... | ignored if  | 
| plot | a list of arguments for  | 
an object of class "pit", which inherits from class
"histogram" (see hist).
It is returned invisibly if a plot is produced.
Michaela Paul and Sebastian Meyer
Czado, C., Gneiting, T. and Held, L. (2009): Predictive model assessment for count data. Biometrics, 65 (4), 1254-1261. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.1541-0420.2009.01191.x")}
## Simulation example of Czado et al. (2009, Section 2.4)
set.seed(100)
x <- rnbinom(200, mu = 5, size = 2)
pdistrs <- list("NB(5,0)"   = function (x) ppois(x, lambda=5),
                "NB(5,1/2)" = function (x) pnbinom(x, mu=5, size=2),
                "NB(5,1)"   = function (x) pnbinom(x, mu=5, size=1))
## Reproduce Figure 1
op <- par(mfrow = c(1,3))
for (i in seq_along(pdistrs)) {
    pit(x, pdistr = pdistrs[[i]], J = 10,
        plot = list(ylim = c(0,2.75), main = names(pdistrs)[i]))
    box()
}
par(op)
## Alternative call using ... arguments for pdistr (less efficient)
stopifnot(identical(pit(x, "pnbinom", mu = 5, size = 2, plot = FALSE),
                    pit(x, pdistrs[[2]], plot = FALSE)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.