gofN
, making residual and scale-location plots.The plot()
method uses R graphics.
The ggplot2::autoplot()
method uses ggplot2 and ggrepel.
# S3 method for gofN
plot(
x,
against = NULL,
which = 1:2,
col = 1,
pch = 1,
cex = 1,
bg = 0,
...,
ask = length(which) > 1 && dev.interactive(TRUE),
id.n = 3,
id.label = NULL,
main = "{type} for {sQuote(name)}",
xlab = NULL,
ylim = NULL,
cex.id = 0.75
)# S3 method for gofN
autoplot(
x,
against = .fitted,
which = 1:2,
mappings = list(),
geom_args = list(),
id.n = 3,
id.label = NULL
)
autoplot.gofN()
returns a list of ggplot
objects that
if printed render to diagnostic plots. If there is only one, the
object itself is returned.
a gofN
object.
what the residuals should be plotted against. Note that different methods use different formats: see Details. Categorical (factor
and ordered
) values are visualised using boxplots, with ordered
values also adding a smoothing line like the quantitative. Defaults to the fitted values.
which to plot (1
for residuals plot, 2
for 3
for normal quantile-quantile plot).
vector of values (wrapped in I()
), network attribute, or a formula whose RHS gives an expression in terms of network attributes to plot against.
additional arguments to plot()
, qqnorm()
, and qqline()
, and others.
whether the user should be prompted between the plots.
maximum number of extreme points to label explicitly.
specification for how extreme points are to be labeled, defaulting to network's index in the combined network.
a template for the plots' titles; these use glue()
's templating, with {type}
replaced with the type of plot and {name}
replaced with the statistic.
horizontal axis label; defaults to a character representation of against
.
vertical range for the plots, interpreted as in graphics::plot()
; can be specified as a list with 3 elements, giving the range for the corresponding plot according to the plot numbers for the which=
argument, and can be used to ensure that, e.g., diagnostic plots for different models are on the same scale.
scaling factor for characters used to label extreme points; see plot.lm()
.
a named list of lists of mappings constructed by ggplot2::aes()
overriding the defaults. See Details below.
a named list of lists of arguments overriding the defaults for the individual geoms. See Details below.
autoplot.gofN()
constructs the plots out of ggplot2::ggplot()
,
ggplot2::geom_point()
(for numeric against
), ggplot2::geom_boxplot()
for
categorical or ordinal against
), and ggplot2::geom_smooth()
(for numeric
or ordinal against
), and ggrepel::geom_text_repel()
. Mappings and
arguments passed through mappings
and geom_args
override the
respective defaults. They may have elements default
(for
ggplot()
), point
(for geom_point()
and geom_boxplot()
),
smooth
(for geom_smooth
), and text
(for geom_text_repel()
).
For the plot()
method, against
and id.label
can be vectors of values (enclosed in I()
to be used as is), a character string identifying a network attribute, or a formula whose RHS gives an expression in terms of network attributes to plot against. The against
formula may also contain a .fitted
variable which will be substituted with the fitted values.
For autoplot.gofN()
, against
and id.label
are interpreted as
expressions in terms of network attributes and values generated by
augment.gofN()
, included .fitted
for the fitted values.
gofN()
for examples, plot.lm()
, graphics::plot()
for regression diagnostic plots and their parameters.