mnetPowerSim {modnets} | R Documentation |
Power simulator for cross-sectional and idiographic networks
Description
Samples data based on several parameters, mainly used to see how different
sample sizes perform given various parameterizations when simulating from
network models, especially moderated networks. See simNet
for
more details about arguments as well as the warning about simulations that
fail.
Usage
mnetPowerSim(
niter = 10,
N = 100,
p = 5,
m = FALSE,
m1 = 0,
m2 = 0.1,
sparsity = 0.5,
lags = NULL,
trueNet = NULL,
threshold = TRUE,
rule = "OR",
avg = TRUE,
maxiter = 100,
saveFits = TRUE,
saveData = FALSE,
intercepts = NULL,
mbinary = FALSE,
select = NULL,
vargs = list(),
type = "g",
gibbs = TRUE,
ordinal = FALSE,
mord = FALSE,
nLevels = 5,
minOrd = 3,
div = 1000,
modType = "none",
m1_range = NULL,
m2_range = c(0.1, 0.3),
time = TRUE,
skewErr = FALSE,
nCores = 1,
cluster = "mclapply",
fixedPar = NULL,
V2 = 1,
...
)
Arguments
niter |
Number of iterations/samples to take for each combination of parameters. |
N |
Numeric value, or vector of sample sizes to generate data with. |
p |
Numeric value, or vector of network sizes. |
m |
If a value is provided then a moderated network will be simulated.
See |
m1 |
Functions similarly to |
m2 |
Numeric. If |
sparsity |
Numeric value between 0 and 1. Determines the sparsity of sampled network matrices. |
lags |
Determines whether the network should be a temporal network or
not. If simulating a temporal network, set to |
trueNet |
The adjacency matrix of the data-generating network model, or a list containing the adjacency matrix as the first element, and the interaction matrix as the second element. |
threshold |
See corresponding argument in |
rule |
Only applies to GGMs (including between-subjects networks) when a
threshold is supplied. The |
avg |
See corresponding argument of |
maxiter |
If a model fails to be fit, this determines the maximum number of iterations to re-try it before giving up. Will also simulate new datasets at each iteration. |
saveFits |
Logical. Determines whether to save the models fit to each dataset at each iteration. |
saveData |
Logical. Determines whether to save the datasets generated at each iteration. |
intercepts |
A vector of means for sampling node values. |
mbinary |
Logical. Determines whether the moderator should be a binary variable. |
select |
Identifies a variable selection function – either
|
vargs |
A named list of arguments relevant to the variable selection
procedure specified by the |
type |
Can supply a variable selection object, such as the output from
either |
gibbs |
If |
ordinal |
Logical. Determines whether to generate ordinal values or not. |
mord |
Logical. Determines whether the moderator variable should be simulated as ordinal. |
nLevels |
Number of levels for the ordinal variables. Only relevant if
|
minOrd |
The minimum number of unique values allowed for each variable. |
div |
A value to use as a sign that the sampler diverged. Can be
increased based on expected range of values. If a datapoint is larger than
|
modType |
Determines the type of moderation to employ, such as
|
m1_range |
Numeric vector of length 2. The range of values for moderator main effect coefficients. |
m2_range |
Numeric vector of length 2. The range of values for moderator interaction effect coefficients. |
time |
If |
skewErr |
The skewness parameter for the |
nCores |
Numeric value indicating the number of CPU cores to use for the
resampling. If |
cluster |
Character vector indicating which type of parallelization to
use, if |
fixedPar |
Numeric. If provided, then this will be set as the
coefficient value for all edges in the network. Provides a way to
standardize the parameter values while varying the sparsity of the network.
If |
V2 |
If |
... |
Additional arguments. |
Details
Evaluates how closely an estimated network is with the true network with regards to metrics such as sensitivity, specificity, and precision, among others. Doesn't calculate values for power, but can be used to serve a similar function as a traditional power analysis based on simulated datasets.
Value
Power simulation results
See Also
summary.mnetPower, plotPower, simNet,
mlGVARsim
Examples
x <- mnetPowerSim(niter = 10, N = c(100, 200))
summary(x)
plot(x)