plotMods function

Plot conditional networks at different levels of the moderator

Plot conditional networks at different levels of the moderator

An easy wrapper for plotting the same network at different levels of a moderator. Using the mval argument of the fitNetwork

function, you can create multiple models---conditional networks---wherein the same model is fit at different values of the moderator.

plotMods( nets, nodewise = FALSE, elsize = 2, vsize = NULL, elabs = TRUE, predict = NULL, layout = NULL, which.net = "temporal", ... )

Arguments

  • nets: List of network models fit with fitNetwork, where mval has been specified.
  • nodewise: See corresponding argument in plotNet.
  • elsize: Numeric value to indicate the size of the edge labels.
  • vsize: Numeric value to indicate the size of the nodes. If NULL, then a default value will be determined based on the number of nodes in the network.
  • elabs: If TRUE, then edges will be labeled with their numeric values.
  • predict: See corresponding argument in plotNet.
  • layout: Can be a character string, corresponding to the options in qgraph::qgraph, or can be a matrix that defines the layout (e.g., based on the qgraph::averageLayout function). Recommended to leave as NULL, so that the layout will be based on the list of networks provided.
  • which.net: See corresponding argument in plotNet.
  • ...: Additional arguments.

Returns

Returns a plot where multiple conditional networks are plotted side by side.

Details

Importantly, this function will fix a common layout across all conditional networks so that the network can be easily compared (visually) at different levels of the moderator.

Examples

data <- na.omit(psychTools::msq[, c('hostile', 'lonely', 'nervous', 'sleepy', 'depressed')]) fit0 <- fitNetwork(data, moderators = 'depressed', mval = 0) fit1 <- fitNetwork(data, moderators = 'depressed', mval = 1) fit2 <- fitNetwork(data, moderators = 'depressed', mval = 2) fits <- list(fit0, fit1, fit2) plotMods(fits)

See Also

fitNetwork

  • Maintainer: Trevor Swanson
  • License: GPL (>= 3)
  • Last published: 2021-10-01