pithist {countreg}R Documentation

PIT Histograms for Assessing Goodness of Fit of Probability Models

Description

PIT histograms graphically compare empirical probabilities from fitted models with a uniform distribution.

Usage

pithist(object, type = c("random", "proportional"), nsim = 1L,
  breaks = NULL, xlim = c(0, 1), ylim = NULL,
  xlab = "PIT", ylab = "Density", main = NULL,
  border = "black", fill = "lightgray", col = "#B61A51",
  lwd = 2, lty = 1, freq = FALSE, ...)

Arguments

object

an object from which a pit can be extracted.

type

character. In case of discrete distributions should the PITs be drawn randomly from the corresponding interval or distributed proportionally?

nsim

integer. If type is "random" how many simulated PITs should be drawn?

breaks

numeric. Breaks for the histogram intervals.

xlab, ylab, main

graphical parameters.

xlim, ylim, border, fill, col, lwd, lty

graphical parameters. These may pertain either to the whole plot or just the histogram or just the fitted line.

freq, ...

further arguments passed to hist.

Details

PIT histograms graphically the probability integral transform (PIT), i.e., observed probabilities from fitted probability models, with a uniform distribution. It leverages the pit generic and then essentially draws a hist.

In case of discrete distributions the PIT is either drawn randomly from the corresponding interval or distributed proportionally in the histogram.

References

Czado C, Gneiting T, Held L (2009). “Predictive Model Assessment for Count Data.” Biometrics, 65(4), 1254–1261.

See Also

pit, hist

Examples

## count data regression models: crab satellites
data("CrabSatellites", package = "countreg")
cs_p   <-    glm(satellites ~     width + color, data = CrabSatellites, family = poisson)
cs_hnb <- hurdle(satellites ~ 1 | width + color, data = CrabSatellites, dist = "negbin")

## PIT histograms
par(mfrow = c(1, 2))
pithist(cs_p, ylim = c(0, 4.2))
pithist(cs_hnb, ylim = c(0, 4.2))
par(mfrow = c(1, 1))


[Package countreg version 0.2-1 Index]