geom_*
and stat_*
for Producing Quantile Residual Q-Q Plots with `ggplot2`geom_worm_points.Rd
Various geom_*
and stat_*
used within
autoplot
for producing quantile residual Q-Q plots.
geom_worm_points( mapping = NULL, data = NULL, stat = "identity", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) stat_worm_confint( mapping = NULL, data = NULL, geom = "worm_confint", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) geom_worm_confint( mapping = NULL, data = NULL, stat = "worm_confint", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) geom_worm_ref( mapping = NULL, data = NULL, stat = "worm_ref", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )
mapping | Set of aesthetic mappings created by |
---|---|
data | The data to be displayed in this layer. There are three options: If A A |
stat | The statistical transformation to use on the data for this layer, as a string. |
position | Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm | If |
show.legend | logical. Should this layer be included in the legends?
|
inherit.aes | If |
... | Other arguments passed on to |
geom | The geometric object to use display the data |
require("ggplot2") ## Fit model data("CrabSatellites", package = "countreg") m1_pois <- glm(satellites ~ width + color, data = CrabSatellites, family = poisson) m2_pois <- glm(satellites ~ color, data = CrabSatellites, family = poisson) ## Compute wormplot w1 <- wormplot(m1_pois, plot = FALSE) w2 <- wormplot(m2_pois, plot = FALSE) d <- c(w1, w2) ## Get label names xlab <- unique(attr(d, "xlab")) ylab <- unique(attr(d, "ylab")) main <- attr(d, "main") main <- make.names(main, unique = TRUE) d$group <- factor(d$group, labels = main) ggplot(data = d, aes(x, y, na.rm = TRUE)) + geom_worm_points() + geom_worm_confint( aes( x_lwr = x_ci_lwr, x_upr = x_ci_upr, y_lwr = y_ci_lwr, y_upr = y_ci_upr ) ) + geom_worm_ref() + facet_wrap(~group) + xlab(xlab) + ylab(ylab)