Description Usage Arguments Details Value Examples
View source: R/8_tidy_mixpoissonreg.R
This function provides ggplot2-based counterparts to the plots produced by plot.mixpoissonreg
.
Currently there are six plots available. They contain residual analysis and global influence diagnostics. The plots are selectable by
the which
argument. The plots are: Residuals vs. obs. numbers; Normal Q-Q plots, which may contain simulated envelopes, if the fitted object
has simulated envelopes; Cook's distances vs. obs. numbers; Generalized Cook's distances vs. obs. numbers; Cook's distances vs. Generalized Cook's distances;
Response variables vs. fitted means. By default, the first two plots and the last two plots are provided.
If both ncol and nrow are NULL
, the plots will be placed one at a time. To place multiple plots, set the values for nrow
or ncol
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ## S3 method for class 'mixpoissonreg'
autoplot(
object,
which = c(1, 2, 5, 6),
title = list("Residuals vs Obs. number", "Normal Q-Q", "Cook's distance",
"Generalized Cook's distance", "Cook's dist vs Generalized Cook's dist",
"Response vs Fitted means"),
title.bold = FALSE,
title.size = NULL,
title.colour = NULL,
label.repel = TRUE,
x.axis.col = NULL,
y.axis.col = NULL,
x.axis.size = NULL,
y.axis.size = NULL,
cook.plot.type = "linerange",
cook.plot.pointshape = NULL,
nrow = NULL,
ncol = NULL,
qqline = TRUE,
ask = prod(graphics::par("mfcol")) < length(which) && grDevices::dev.interactive(),
include.modeltype = TRUE,
include.residualtype = FALSE,
sub.caption = NULL,
sub.caption.col = NULL,
sub.caption.size = NULL,
sub.caption.face = NULL,
sub.caption.hjust = 0.5,
env_alpha = 0.5,
env_fill = "grey70",
gpar_sub.caption = list(fontface = "bold"),
colour = "#444444",
size = NULL,
linetype = NULL,
alpha = NULL,
fill = NULL,
shape = NULL,
label = TRUE,
label.label = NULL,
label.colour = "#000000",
label.alpha = NULL,
label.size = NULL,
label.angle = NULL,
label.family = NULL,
label.fontface = NULL,
label.lineheight = NULL,
label.hjust = NULL,
label.vjust = NULL,
label.n = 3,
ad.colour = "#888888",
ad.linetype = "dashed",
ad.size = 0.2,
...
)
|
object |
A |
which |
a list or vector indicating which plots should be displayed. If a subset of the plots is required, specify a subset of the numbers 1:6,
see title below for the different kinds. In
plot number 2, 'Normal Q-Q', if the |
title |
titles to appear above the plots; character vector or list of valid graphics annotations. Can be set to "" to suppress all titles. |
title.bold |
logical indicating whether the titles should be bold. The default is FALSE. |
title.size |
numerical indicating the size of the titles. |
title.colour |
title colour. |
label.repel |
Logical flag indicating whether to use ggrepel to place the labels. |
x.axis.col |
colour of the x axis title. |
y.axis.col |
colour of the y axis title. |
x.axis.size |
size of the x axis title. |
y.axis.size |
size of the y axis title. |
cook.plot.type |
character indicating the type of plot for Cook's distance and generalized Cook's distance. Default is "linerange". The options are "linerange" and "points". |
cook.plot.pointshape |
the shape of points if "cook.plot.type" is set to "points". |
nrow |
Number of facet/subplot rows. If both |
ncol |
Number of facet/subplot columns. If both |
qqline |
logical; if |
ask |
logical; if |
include.modeltype |
logical. Indicates whether the model type ('NB' or 'PIG') should be displayed on the titles. |
include.residualtype |
local. Indicates whether the name of the residual ('Pearson' or 'Score') should be displayed on the title of plot 1 (Residuals vs. Index). |
sub.caption |
common title-above the figures if there are more than one. If NULL, as by default, a possible abbreviated version of |
sub.caption.col |
color of subcaption (when one figure at a time). |
sub.caption.size |
size of subcaption (when one figure at a time). |
sub.caption.face |
font face for subcaption, options are: "plain", "bold", "italic" and "bold.italic". |
sub.caption.hjust |
indicates the position of the subcaption (when one figure at a time). The default is 0.5, which indicates that the subcaption is centered, a value 0 places the subcaption at the left side of the plot whereas a value of 1 places the subcaption at the right side of the plot. |
env_alpha |
alpha of the envelope region (when the fitted model has envelopes) |
env_fill |
the colour of the filling in the envelopes. |
gpar_sub.caption |
list of gpar parameters to be used as common title in the case of multiple plots. The title will be given in sub.caption argument. See
the help of |
colour |
line colour. |
size |
point size. |
linetype |
line type. |
alpha |
alpha of the plot. |
fill |
fill colour. |
shape |
point shape. |
label |
Logical value whether to display labels. |
label.label |
vector of labels. If |
label.colour |
Colour for text labels. |
label.alpha |
Alpha for text labels. |
label.size |
Size for text labels. |
label.angle |
Angle for text labels. |
label.family |
Font family for text labels. |
label.fontface |
Fontface for text labels. |
label.lineheight |
Lineheight for text labels. |
label.hjust |
Horizontal adjustment for text labels. |
label.vjust |
Vertical adjustment for text labels. |
label.n |
Number of points to be laeled in each plot, starting with the most extreme. |
ad.colour |
Line colour for additional lines. |
ad.linetype |
Line type for additional lines. |
ad.size |
Fill colour for additional lines. |
... |
other arguments passed to methods. |
Based on autoplot.lm
from the excellent ggfortify package, ggfortify.
sub.caption - by default the function call - is shown as a subtitle (under the x-axis title) on each plot when plots are on separate pages, or as a subtitle in the outer margin when there are multiple plots per page.
Called for its side effects.
1 2 | daysabs_prog <- mixpoissonregML(daysabs ~ prog, data = Attendance)
autoplot(daysabs_prog)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.