Plots the Goodness of fit for the output of a model of class ergm or btergm

stat_plot_gof(
  gof,
  median_include = TRUE,
  median_col = "black",
  median_lwd = 2,
  median_lty = "solid",
  mean_include = TRUE,
  mean_col = "black",
  mean_lwd = 1,
  mean_lty = "dashed",
  ...
)

Arguments

gof

A gof model object for a fitted ergm or btergm model

median_include

logical, should the median be included? Default is TRUE

median_col

character, name of the color to plot the median in.

median_lwd

number, width of the line for the median.

median_lty

what line type should be used to plot the median. Line types can either be specified as an integer (0 = blank, 1 = solid (default), 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash) or as one of the character strings "blank", "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash", where "blank" uses ‘invisible lines’ (i.e., does not draw them).

mean_include

logical, should the mean be included? Default is TRUE. Ignored if gof is the gof of an ergm.

mean_col

character, name of the color to plot the mean in.

mean_lwd

number, width of the line for the mean.

mean_lty

what line type should be used to plot the medn. Default is "dashed".

...

additional arguments. When, gof is an ergm gof object, it will be passed to the boxplot function (really only somewhat potentially useful to set color in the border argument). For a btergm gof, it is passed to the plot.gof function of the btergm package.

Value

Plots displaying the Goodness of Fit

Details

This function plots the goodness-of-fit of unipartite Exponential Random Graphs Models or BTERGM models.

It does not process bipartite ERGMs model objects nor other types of Exponential random graph models object.

The graphical arguments for this function are only used when a btergm gof object is passed, since the ergm gof object does not support the setting of graphical arguments (with the exception of the ... argument).

See also

Other statistics functions: stat_ef_int(), stat_plot_gof_as_btergm()

Examples

if (FALSE) { # \dontrun{
### ergm model
data(florentine, package = "snafun")
flom <- to_network(florentine$flomarriage)
m_ergm <- ergm::ergm(flom ~ edges + nodecov("Wealth"))
gof_ergm <- ergm::gof(m_ergm)
stat_plot_gof(gof_ergm)

### btergm model
data(alliances, package = "SNA4DSData")
m_btergm <- btergm::btergm(allianceNets ~ edges + 
  gwesp(0, fixed = TRUE) +
  edgecov(lastYearsSharedPartners) + 
  edgecov(militaryDisputes) + 
  nodecov("polity") +
  nodecov("Composite_Index_National_Capability") + 
  absdiff("polity") + 
  absdiff("Composite_Index_National_Capability") +
  edgecov(sharedBorder), 
  R = 10, # number of bootstraps
  parallel = "snow", ncpus = 16  # optional line
)

# gof with on;y 10 simulations to keep time for the example low
gof_btergm <- btergm:::gof.btergm(m_btergm, nsim = 10)
stat_plot_gof(gof_btergm)
stat_plot_gof(gof_btergm, median_include = FALSE)
stat_plot_gof(gof_btergm, mean_col = "green", mean_lwd = 4, mean_lty = "dotted")
stat_plot_gof(gof_btergm, mean_include = FALSE, median_col = "orange")
stat_plot_gof(gof_btergm, mean_include = FALSE, median_include = FALSE)
} # }