net {modnets}R Documentation

Get adjacency matrices from fit objects

Description

net returns the adjacency matrix for any network model fit using functions from the modnets package. netInts returns a matrix of interaction terms associated with a moderated network.

Usage

net(
  fit,
  n = "beta",
  threshold = FALSE,
  rule = "OR",
  binary = FALSE,
  nodewise = FALSE,
  d = 14,
  r = NULL
)

netInts(
  fit,
  n = "temporal",
  threshold = FALSE,
  avg = FALSE,
  rule = "none",
  r = NULL,
  empty = TRUE,
  mselect = NULL
)

Arguments

fit

A fitted network model. Can be the output from fitNetwork, mlGVAR, lmerVAR, bootNet, resample, simNet, or mlGVARsim.

n

When multiple networks exist for a single object, this allows the user to indicate which adjacency matrix to return. For a GGM, all values of this argument return the same adjacency matrix. For a SUR network, "beta" and "temporal" return the coefficients associated with the temporal network, while "pdc" returns the Partial Directed Correlations, or the standardized temporal network. "contemporaneous" and "pcc" return the standardized contemporaneous network (Partial Contemporaneous Correlations). "kappa" returns the unstandardized residual covariance matrix. All of these terms apply for multilevel networks, but "between" can also return the between-subjects network. If a numeric or logical value is supplied, however, this argument will function as the threshold argument. A numeric value will set a threshold at the supplied value, while TRUE will set a threshold of .05.

threshold

A numeric or logical value to set a p-value threshold. TRUE will automatically set the threshold at .05.

rule

Only applies to GGMs (including between-subjects networks) when a threshold is supplied. The "AND" rule will only preserve edges when both corresponding coefficients have p-values below the threshold, while the "OR" rule will preserve an edge so long as one of the two coefficients have a p-value below the supplied threshold.

binary

Logical. If TRUE then the weighted adjacency matrix will be converted into an unweighted adjacency matrix.

nodewise

Logical, only applies to GGMs (including between-subjects networks). If TRUE then the adjacency matrix will retain all coefficients in their original form. In this case, values in rows represent the coefficients predicting the columns.

d

Numeric. Only used for output of mlGVARsim, or simNet when lags = 1. Sets the number of decimal places to round the output to.

r

Numeric. Chooses which rows/columns to remove from the output, if desired.

avg

Logical. For netInts, determines whether to take the average two corresponding interaction terms.

empty

Logical. Determines the output of netInts when fit is not a moderated network. If TRUE then an empty list will be returned. If FALSE then a matrix of zeros will be returned.

mselect

Only used for netInts when there is more than one exogenous moderator. Allows the user to indicate which moderator should be used to construct the interaction matrix.

Details

For GGMs when a non-symmetric matrix is requested, columns will represent outcomes and rows will represent predictors. For temporal networks, columns represent predictors and rows represent outcomes.

Can also be used with output from the resample and bootNet functions.

Value

An adjacency matrix representing a network or a matrix of interaction terms.

See Also

fitNetwork, mlGVAR, lmerVAR, bootNet, resample, simNet, mlGVARsim

Examples

x <- fitNetwork(ggmDat, 'M')

net(x, threshold = .05)
netInts(x, threshold = TRUE)


y <- mlGVAR(mlgvarDat, 'M')

net(y, n = 'beta')
net(y, n = 'pcc')
net(y, n = 'between')

netInts(y)


[Package modnets version 0.9.0 Index]