plotMods {modnets}R Documentation

Plot conditional networks at different levels of the moderator

Description

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.

Usage

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.

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.

Value

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

See Also

fitNetwork

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)

[Package modnets version 0.9.0 Index]