Description Usage Arguments Details Value Author(s) References See Also Examples
The Hanging Rootogram is variation of the histogram with the vertical axis showing the square root of the frequencies hanging from (Touchard) fitted values so that the discrepancies are visualized against a straight line (the axis) rather than against a curve.
1 2 3 4 5 | rgram(object, xlim = NULL, ylim = NULL, xlab = "Count", ylab = NULL, main = NULL,
breaks = NULL, border = "black", fill = "lightgray", col = "blue",
lwd = 2, pch = 19, lty = 1, axes = TRUE, width = NULL, plot = TRUE,
style = c("hanging", "standing", "suspended"), scale = c("sqrt", "raw"),
max = NULL, ...)
|
object |
either a |
breaks |
numeric. Breaks for the bar intervals. |
style |
character. Style of rootogram (see below). |
scale |
character. Scale of vertical axis, raw frequencies or their
square roots; |
plot |
logical. Should the plot be displayed? |
width |
numeric. Widths of the histogram bars. |
main |
character. Title for the plot. |
xlab |
character. Label for the x axis. |
ylab |
character. Label for the y axis. |
xlim, ylim, border, fill, col, lwd, pch, lty, axes |
graphical parameters. |
max |
the largest count value used when using the |
... |
further graphical parameters passed to the plotting function. |
The rootogram is a visual tool for comparing the empirical distribution and fitted values (here from a Touchard model). The square-root scale de-emphasizes outlying values and right skewness (common for count data). The hanging (from the fitted values) style allows discrepancies to be visualized against a straight line (the axis).
The code has been largely based on more general rootogram functions:
rootogram
in package vcd and
countreg::rootogram
available through R-forge.
Returns invisibly a data frame with quantities used in plotting.
Bernardo Andrade and Sandro Oliveira
Friendly M, Meyer D (2015). Discrete Data Analysis with R. Chapman and Hall.
Kleiber C, Zeileis A (2016). Visualizing Count Data Regressions Using Rootograms. The American Statistician, 70(3), 296–303. doi: 10.1080/00031305.2016.1173590.
Tukey JW (1977). Exploratory Data Analysis. Addison-Wesley, Reading.
1 2 3 4 5 6 7 8 9 10 11 12 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.