View source: R/rootogram4.vglm.R
rootogram4 | R Documentation |
A graphical technique for comparing the observed and fitted counts from a probability model, on a square root scale.
rootogram4(object, ...)
rootogram4vglm(object, newdata = NULL, breaks = NULL, max = NULL,
xlab = NULL, main = NULL, width = NULL, ...)
object |
an object of class |
newdata |
Data upon which to base the calculations. The default is the one used to fit the model. |
breaks |
numeric. Breaks for the histogram intervals. |
max |
maximum count displayed.
If an error message occurs regarding running out of memory
then use this argument; it might occur with a very long
tailed distribution such as |
xlab , main |
graphical parameters. |
width |
numeric. Widths of the histogram bars. |
... |
any additional arguments to
|
Rootograms are a useful graphical technique for comparing the observed counts with the expected counts given a probability model.
This S4 implementation is based very heavily
on rootogram
coming from
countreg. This package is primarily written by
A. Zeileis and
C. Kleiber.
That package is currently on R-Forge but not CRAN, and
it is based on S3.
Since VGAM is written using S4, it was necessary
to define an S4 generic function called
rootogram4()
which dispatches appropriately for
S4 objects.
Currently, only a selected number of VGAM family functions are implemented. Over time, hopefully more and more will be completed.
See
rootogram
in countreg;
an object of class "rootogram0"
inheriting from "data.frame"
with
about 8 variables.
This function is rudimentary and based totally on the implementation in countreg.
The function names used coming from countreg have been renamed slightly to avoid conflict.
Package countreg is primarily written by
A. Zeileis and
C. Kleiber.
Function rootogram4()
is based very heavily
on countreg.
T. W. Yee wrote code to unpack variables from
many various models
and feed them into the appropriate d
-type function.
Friendly, M. and Meyer, D. (2016). Discrete Data Analysis with R: Visualization and Modeling Techniques for Categorical and Count Data, Boca Raton, FL, USA: Chapman & Hall/CRC Press.
Kleiber, C. and Zeileis, A. (2016) “Visualizing Count Data Regressions Using Rootograms.” The American Statistician, 70(3), 296–303. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00031305.2016.1173590")}.
Tukey, J. W. (1977) Exploratory Data Analysis, Reading, MA, USA: Addison-Wesley.
vglm
,
vgam
,
glm
,
zipoisson
,
zapoisson
,
rootogram
in countreg.
## Not run:
data("hspider", package = "VGAM") # Count responses
hs.p <- vglm(Pardlugu ~ CoveHerb, poissonff, data = hspider)
hs.nb <- vglm(Pardlugu ~ CoveHerb, negbinomial, data = hspider)
hs.zip <- vglm(Pardlugu ~ CoveHerb, zipoisson, data = hspider)
hs.zap <- vglm(Pardlugu ~ CoveHerb, zapoisson, data = hspider)
opar <- par(mfrow = c(2, 2)) # Plot the rootograms
rootogram4(hs.p, max = 15, main = "poissonff")
rootogram4(hs.nb, max = 15, main = "negbinomial")
rootogram4(hs.zip, max = 15, main = "zipoisson")
rootogram4(hs.zap, max = 15, main = "zapoisson")
par(opar)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.