Plot and print methods for goodness-of-fit output for network models.
# S3 method for boxplot
plot(x, relative = TRUE, transform = function(x) x,
xlim = NULL, main = x$label, xlab = x$label, ylab = "Frequency",
border = "darkgray", boxplot.lwd = 0.8, outline = FALSE,
median = TRUE, median.col = "black", median.lty = "solid",
median.lwd = 2, mean = TRUE, mean.col = "black",
mean.lty = "dashed", mean.lwd = 1, ...)# S3 method for gof
plot(x, mfrow = TRUE, ...)
# S3 method for pr
plot(x, add = FALSE, main = x$label, avg = c("none",
"horizontal", "vertical", "threshold"), spread.estimate =
c("boxplot", "stderror", "stddev"), lwd = 3, rgraph = FALSE,
col = "#5886be", random.col = "#5886be44", pr.poly = 0, ...)
# S3 method for roc
plot(x, add = FALSE, main = x$label, avg = c("none",
"horizontal", "vertical", "threshold"), spread.estimate =
c("boxplot", "stderror", "stddev"), lwd = 3, rgraph = FALSE,
col = "#bd0017", random.col = "#bd001744", ...)
# S3 method for rocpr
plot(x, main = x$label, roc.avg = c("none",
"horizontal", "vertical", "threshold"),
roc.spread.estimate = c("boxplot", "stderror", "stddev"),
roc.lwd = 3, roc.rgraph = FALSE, roc.col = "#bd0017",
roc.random.col = "#bd001744", pr.avg = c("none", "horizontal",
"vertical", "threshold"), pr.spread.estimate = c("boxplot",
"stderror", "stddev"), pr.lwd = 3, pr.rgraph = FALSE,
pr.col = "#5886be", pr.random.col = "#5886be44", pr.poly = 0,
...)
# S3 method for univariate
plot(x, main = x$label, sim.hist = TRUE,
sim.bar = TRUE, sim.density = TRUE, obs.hist = FALSE,
obs.bar = TRUE, obs.density = TRUE, sim.adjust = 1,
obs.adjust = 1, sim.lwd = 2, obs.lwd = 2, sim.col = "black",
obs.col = "red", ...)
# S3 method for boxplot
print(x, ...)
# S3 method for gof
print(x, ...)
# S3 method for pr
print(x, ...)
# S3 method for roc
print(x, ...)
# S3 method for rocpr
print(x, ...)
# S3 method for univariate
print(x, ...)
Add the ROC and/or PR curve to an existing plot?
Averaging pattern for the ROC and PR curve(s) if multiple target time steps were used. Allowed values are "none"
(plot all curves separately), "horizontal"
(horizontal averaging), "vertical"
(vertical averaging), and "threshold"
(threshold (= cutoff) averaging). Note that while threshold averaging is always feasible, vertical and horizontal averaging are not well-defined if the graph cannot be represented as a function x->y and y->x, respectively. More information can be obtained from the help pages of the ROCR package, the functions of which are employed here.
Color of the borders of the boxplots.
Line width of boxplot.
Color of the ROC or PR curve.
Line width.
Main title of a GOF plot.
Plot the mean curve for the observed network?
Color of the mean of the observed network statistic.
Line type of mean line. For example "dashed" or "solid".
Line width of mean line.
Plot the median curve for the observed network?
Color of the median of the observed network statistic.
Line type of median line. For example "dashed" or "solid".
Line width of median line.
Should the GOF plots come out separately (mfrow = FALSE
), or should all statistics be aligned in a single diagram (mfrow = TRUE
)? Returning the plots separately can be helpful if the output is redirected to a multipage PDF or TIFF file.
Bandwidth adjustment parameter for the density curve.
Draw a bar for the median of the statistic for the observed networks?
Color for the observed network(s).
Draw a density curve fot the statistic for the observed networks?
Draw a histogram for the observed networks?
Line width for the observed network(s).
Print outliers in the boxplots?
Averaging pattern for the PR curve(s) if multiple target time steps were used. Allowed values are "none"
(plot all curves separately), "horizontal"
(horizontal averaging), "vertical"
(vertical averaging), and "threshold"
(threshold (= cutoff) averaging). Note that while threshold averaging is always feasible, vertical and horizontal averaging are not well-defined if the graph cannot be represented as a function x->y and y->x, respectively. More information can be obtained from the help pages of the ROCR package, the functions of which are employed here.
Color of the PR curve.
Line width.
If a value of 0
is set, nothing special happens. If a value of 1
is set, a straight line is fitted through the PR curve and displayed. Values between 2
and 9
fit higher-order polynomial curves through the PR curve and display the resulting curve. This argument allows to check whether the imputation of the first precision value in the PR curve yielded a reasonable result (in case the value had to be imputed).
Color of the PR curve of the random graph prediction.
Should an PR curve also be drawn for a random graph? This serves as a baseline against which to compare the actual PR curve.
When multiple target time steps are used and curve averaging is enabled, the variation around the average curve can be visualized as standard error bars ("stderror"
), standard deviation bars ("stddev"
), or by using box plots ("boxplot"
). Note that the function plotCI, which is used internally by the ROCR package to draw error bars, might raise a warning if the spread of the curves at certain positions is 0. More details can be found in the documentation of the ROCR package, the functions of which are employed here.
Color of the ROC or PR curve of the random graph prediction.
Print relative frequencies (as opposed to absolute frequencies) of a statistic on the y axis?
Should an ROC or PR curve also be drawn for a random graph? This serves as a baseline against which to compare the actual ROC or PR curve.
Averaging pattern for the ROC curve(s) if multiple target time steps were used. Allowed values are "none"
(plot all curves separately), "horizontal"
(horizontal averaging), "vertical"
(vertical averaging), and "threshold"
(threshold (= cutoff) averaging). Note that while threshold averaging is always feasible, vertical and horizontal averaging are not well-defined if the graph cannot be represented as a function x->y and y->x, respectively. More information can be obtained from the help pages of the ROCR package, the functions of which are employed here.
Color of the ROC curve.
Line width.
Color of the ROC curve of the random graph prediction.
Should an ROC curve also be drawn for a random graph? This serves as a baseline against which to compare the actual ROC curve.
When multiple target time steps are used and curve averaging is enabled, the variation around the average curve can be visualized as standard error bars ("stderror"
), standard deviation bars ("stddev"
), or by using box plots ("boxplot"
). Note that the function plotCI, which is used internally by the ROCR package to draw error bars, might raise a warning if the spread of the curves at certain positions is 0. More details can be found in the documentation of the ROCR package, the functions of which are employed here.
Bandwidth adjustment parameter for the density curve.
Draw a bar for the median of the statistic for the simulated networks?
Color for the simulated networks.
Draw a density curve fot the statistic for the simulated networks?
Draw a histogram for the simulated networks?
Line width for the simulated networks.
When multiple target time steps are used and curve averaging is enabled, the variation around the average curve can be visualized as standard error bars ("stderror"
), standard deviation bars ("stddev"
), or by using box plots ("boxplot"
). Note that the function plotCI, which is used internally by the ROCR package to draw error bars, might raise a warning if the spread of the curves at certain positions is 0. More details can be found in the documentation of the ROCR package, the functions of which are employed here.
A function which transforms the y values used for the boxplots. For example, if some of the values become very large and make the output illegible, transform = function(x) x^0.1
or a similar transformation of the values can be used. Note that logarithmic transformations often produce infinite values because log(0) = -Inf
, so one should rather use something like transform = function(x) log1p
to avoid infinite values.
An object created by one of the gof
methods.
Label of the x-axis of a GOF plot.
Horizontal limit of the boxplots. Only the maximum value must be provided, e.g., xlim = 8
.
Label of the y-axis of a GOF plot.
Arbitrary further arguments.
These plot and print methods serve to display the output generated by the gof
function and its methods. See the help page of gof-methods for details on how to compute gof.
Leifeld, Philip, Skyler J. Cranmer and Bruce A. Desmarais (2017): Temporal Exponential Random Graph Models with btergm: Estimation and Bootstrap Confidence Intervals. Journal of Statistical Software 83(6): 1-36. http://dx.doi.org/10.18637/jss.v083.i06.