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 |
nodewise |
See corresponding argument in |
elsize |
Numeric value to indicate the size of the edge labels. |
vsize |
Numeric value to indicate the size of the nodes. If |
elabs |
If |
predict |
See corresponding argument in |
layout |
Can be a character string, corresponding to the options in
|
which.net |
See corresponding argument in |
... |
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
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)