plotBoot {modnets}R Documentation

Plot bootNet outputs

Description

Creates various types of plot to visualize bootNet objects.

Usage

plotBoot(
  x,
  type = "edges",
  net = "temporal",
  plot = "all",
  cor = 0.7,
  order = "mean",
  ci = 0.95,
  pairwise = TRUE,
  interactions = TRUE,
  labels = NULL,
  title = NULL,
  cis = "quantile",
  true = NULL,
  errbars = FALSE,
  vline = FALSE,
  threshold = FALSE,
  difference = FALSE,
  color = FALSE,
  text = FALSE,
  textPos = "value",
  multi = NULL,
  directedDiag = FALSE,
  ...
)

## S3 method for class 'bootNet'
plot(
  x,
  type = "edges",
  net = "temporal",
  plot = "all",
  cor = 0.7,
  order = "mean",
  ci = 0.95,
  pairwise = TRUE,
  interactions = TRUE,
  labels = NULL,
  title = NULL,
  cis = "quantile",
  true = NULL,
  errbars = FALSE,
  vline = FALSE,
  threshold = FALSE,
  difference = FALSE,
  color = FALSE,
  text = FALSE,
  textPos = "value",
  multi = NULL,
  directedDiag = FALSE,
  ...
)

Arguments

x

Output from bootNet. Also some compatiblity with resample objects (when sampMethod != 'stability').

type

The outcome measure to plot. Options include: "edges", "strength", "ei", "outstrength", "instrength", "outei", "inei". The "out-" and "in-" options are only available for temporal networks. Moreover, both related options can be used together in temporal networks, by setting either type = c("outstrength", "instrength") or type = c("outei", "inei").

net

Determines which network to plot coefficients for. Options include: "ggm", "temporal", "contemporaneous", "between". Only relevant to SUR networks or mlGVAR objects.

plot

Primary use is to set as "none" or FALSE in order to return a table containing the constituents of the plot rather than create the plot itself. The options "all" and "both" each essentially indicate that both pairwise and interaction terms are plotted. Can also specify "pairwise" to only plot the pairwise terms, or "interactions" to only plot the interaction terms.

cor

Numeric value to indicate the correlation stability value to be plotted. Only applies to the case-drop bootstrapping output.

order

Determines how to arrange the predictors displayed in the plot. If TRUE, then defaults to "mean". If FALSE then defaults to "id". The "mean" option will arrange the values by the bootstrapped sample means. The "sample" option will arrange the values according to the statistics from the model fitted to the full sample. The "id" option will keep the variables in the same order that they appear in the dataframe. Not relevant to the case-drop bootstrap.

ci

Numeric value between 0 and 1 to specify the confidence level.

pairwise

Logical. Whether to plot pairwise relationships. Defaults to TRUE. If FALSE, this will override the "all" option of the plot argument.

interactions

Logical. Whether to plot interactions. Defaults to TRUE. If FALSE, this will override the "all" option of the plot argument. Only relevant to moderated networks.

labels

Logical. Determines whether to plot names of the predictors.

title

Character vector the title label.

cis

Either "quantile" or "se". If "quantile", then confidence bands will be computed based on quantiles (specified by the ci argument) of the bootstrapped resamples. If "se", then the confidence bands will be computed based on the standard errors associated with the sample statistics. Thus, the "se" argument will always produce a symmetric confidence band, whereas for "quantile" argument this is not necessary. Not relevant to outputs for the case-drop bootstrap.

true

Defaults to NULL, not relevant for the case-drop bootstrap. Can supply another output from fitNetwork, or an adjacency matrix, to serve as the true network in the plot. If there are interactions in the model, then a fitNetwork object is recommended. Alternatively, this argument can be extremely useful for simulated data – especially anything created with simNet. For whatever outcome (e.g., edges, strength, EI) is plotted, supplying another object to true will plot the values related to the true network, i.e., the data-generating model.

errbars

Logical. Not relevant to the case-drop bootstrap. If TRUE, then error bars are used rather than confidence bands. Can be useful to home in on specific variables and see their confidence interval.

vline

Logical or numeric. Not relevant to the case-drop bootstrap. If TRUE, then a dashed vertical line will be plotted at 0. If numeric, then the line will be plotted at the supplied intercept on the x-axis.

threshold

Numeric or logical. Not relevant to the case-drop bootstrap. Has a significant effect on the bootstrapped coefficient distributions. If TRUE, then the default p-value threshold is set to .05. A numeric value can specify a different threshold. Causes the bootNet function to run the object again, only to re-compute the bootstrapped distributions after applying a p-value threshold to the results of each model iteration. If NULL, all coefficient estimates are used in estimating the posterior distribution of each parameter.

difference

Logical. Not relevant to the case-drop bootstrap. If TRUE, then a difference plot is provided rather than a coefficient plot. In the difference plot, the diagonal squares reflect the fitted network coefficients for the the original sample. Black boxes indicate that the difference between the two edges, coefficients, or centrality values being compared is significantly different from 0. The significance level will have already been determined by the parameters used to fit the bootNet object. Gray boxes indicate the difference is not significantly different from 0.

color

Logical. Only applies when difference = TRUE. Determines whether to add colors that reflect the sign of the sample values. Reflected in the diagonal of the difference plot.

text

Logical. For difference plots, if TRUE then the statistics based on the full sample will be labeled in the diagonal boxes. For coefficient plots, setting this to TRUE will plot a label for each variable to reflect the proportion of times that it was selected across all bootstrapped iterations. Only relevant if a threshold was set for the fitted bootstrap models, either specified in the current function or was specified in creating the bootNet object. If a numeric value is provided, this will determine the size of the text label. Defaults to 1.2 when text = TRUE.

textPos

Supports the text argument for coefficient plots. Indicates the x-axis position of where to plot the coefficient labels. Generally will be numeric, but defaults to "value", which means that the text will be labeled on top each point on the plot.

multi

Useful when there are interactions in a model. If TRUE, the single plot with a facet for both pairwise and interaction terms is split into two separate plots. Allows for a more elegant side-by-side plot, and allows arguments that are restricted for plots of either pairwise or interactions (such as text) are plotted. This argument will eventually be expanded to allow one to plot combinations of edge and centrality plots.

directedDiag

See corresponding argument in the bootNet. function.

...

Additional arguments.

Value

A coefficient plot, difference plot, or correlation-stability plot. When plot %in% c('none', FALSE), the table used to construct the relevant plot will be returned as output instead.

See Also

bootNet, resample

Examples


boot1 <- bootNet(ggmDat, caseDrop = TRUE)

plot(boot1)
plotBoot(boot1) # This functions the same as the command above

boot2 <- bootNet(ggmDat)

plot(boot2)
plot(boot2, difference = TRUE)


[Package modnets version 0.9.0 Index]