distplot {vcd} | R Documentation

## Diagnostic Distribution Plots

### Description

Diagnostic distribution plots: poissonness, binomialness and negative binomialness plots.

### Usage

    distplot(x, type = c("poisson", "binomial", "nbinomial"),
      size = NULL, lambda = NULL, legend = TRUE, xlim = NULL, ylim = NULL,
      conf_int = TRUE, conf_level = 0.95, main = NULL,
      xlab = "Number of occurrences", ylab = "Distribution metameter",
      gp = gpar(cex = 0.5), name = "distplot", newpage = TRUE, pop = TRUE, ...)

### Arguments

`x` | either a vector of counts, a 1-way table of frequencies of counts or a data frame or matrix with frequencies in the first column and the corresponding counts in the second column.
`type` | a character string indicating the distribution.
`size` | the size argument for the binomial distribution, only required if `type` is `"binomial"`. If set to `NULL`, `size` is taken to be the maximum count.
`lambda` | parameter of the poisson distribution. If type is `"poisson"` and `lambda` is specified a leveled poissonness plot is produced.
`legend` | logical. Should a legend be plotted?
`xlim` | limits for the x axis.
`ylim` | limits for the y axis.
`conf_int` | logical. Should confidence intervals be plotted?
`conf_level` | confidence level for confidence intervals.
`main` | a title for the plot.
`xlab` | a label for the x axis.
`ylab` | a label for the y axis.
`gp` | a `"gpar"` object controlling the grid graphical parameters of the points.
`name` | name of the plotting viewport.
`newpage` | logical. Should `grid.newpage` be called before plotting?
`pop` | logical. Should the viewport created be popped?
`...` | further arguments passed to `grid.points`.

### Details

`distplot` plots the number of occurrences (counts) against the distribution metameter of the specified distribution. If the distribution fits the data, the plot should show a straight line. See Friendly (2000) for details.

### Author(s)

Achim Zeileis Achim.Zeileis@R-project.org

### References

D. C. Hoaglin (1980), A poissonness plot, The American Statistican, 34, 146–149.

D. C. Hoaglin & J. W. Tukey (1985), Checking the shape of discrete distributions. In D. C. Hoaglin, F. Mosteller, J. W. Tukey (eds.), Exploring Data Tables, Trends and Shapes, chapter 9. John Wiley & Sons, New York.

M. Friendly (2000), Visualizing Categorical Data. SAS Institute, Cary, NC.

### Examples

    ## Simulated data examples:
    dummy <- rnbinom(1000, size = 1.5, prob = 0.8)
    distplot(dummy, type = "nbinomial")

    ## Real data examples:
    data(HorseKicks)
    data(Federalist)
    data(Saxony)
    distplot(HorseKicks, type = "poisson")
    distplot(HorseKicks, type = "poisson", lambda = 0.61)
    distplot(Federalist, type = "poisson")
    distplot(Federalist, type = "nbinomial")
    distplot(Saxony, type = "binomial", size = 12)

[Package vcd version 0.9-6 Index]