bootNet {modnets} | R Documentation |
Bootstrapping network estimation for moderated networks
Description
Follows closely to the methods of bootstrapping found in the bootnet
package. An essential goal behind this function is to expand the methods in
bootnet
to encompass moderated networks.
Usage
bootNet(
data,
m = NULL,
nboots = 10,
lags = NULL,
caseDrop = FALSE,
rule = "OR",
ci = 0.95,
caseMin = 0.05,
caseMax = 0.75,
caseN = 10,
threshold = FALSE,
fits = NULL,
type = "g",
saveMods = TRUE,
verbose = TRUE,
fitCoefs = FALSE,
size = NULL,
nCores = 1,
cluster = "mclapply",
block = FALSE,
maxiter = 10,
directedDiag = FALSE,
beepno = NULL,
dayno = NULL,
...
)
Arguments
data |
Dataframe or matrix. |
m |
Numeric or character string. Indicates which variable should be treated as a moderator (if any). |
nboots |
Number of bootstrapped samples. |
lags |
Numeric or logical, to indicate whether or not a temporal network
is being estimated. Maximum of 1 lag – meaningful values are either 1 or
|
caseDrop |
Logical. Determines whether to do a caseDrop bootstrap procedure or not. |
rule |
Only applies to GGMs (including between-subjects networks) when a
threshold is supplied. The |
ci |
Numeric, between 0 and 1. The level of the confidence intervals estimated. Defaults at .95 |
caseMin |
Numeric. The minimum proportion of the sample that should be
taken when |
caseMax |
Numeric. The maximum proportion of the sample that should be
taken when |
caseN |
Numeric. The number of samples to draw at each sample size
tested when |
threshold |
Logical or numeric. If |
fits |
A list of all fitted models, if available. Not likely to be used. |
type |
See |
saveMods |
Logical. Determines whether or not to return all of the
fitted models – that is, all the models fit to each bootstrapped sample.
Defaults to |
verbose |
Logical. Determines whether a progress bar should be shown, as well as whether messages should be shown. |
fitCoefs |
Logical, refers to the argument in the
|
size |
Numeric. Size of sample to use for bootstrapping. Not recommended. |
nCores |
If a logical or numeric value is provided, then the
bootstrapping procedure will be parallelized across multiple CPUs. If
numeric, this will specify the number of cores to use for the procedure. If
|
cluster |
Character string to indicate which type of parallelization
function to use, if |
block |
Logical or numeric. If specified, then this indicates that
|
maxiter |
The maximum number of iterations for the algorithm to go
through before stopping. In some circumstances, iterated versions of the
model based on subsamples of the data may not be possible to fit. In these
cases, |
directedDiag |
logical |
beepno |
Character string or numeric value to indicate which variable
(if any) encodes the survey number within a single day. Must be used in
conjunction with |
dayno |
Character string or numeric value to indicate which variable (if
any) encodes the survey number within a single day. Must be used in
conjunction with |
... |
Additional arguments. |
Details
Can be used to perform bootstrapped network estimation, as well as perform a
case-drop bootstrap. Details on these two methods can be found in the help
page for the bootnet::bootnet
function.
The defining feature of bootNet
that differentiates it from the
resample
function when sampMethod = "bootstrap"
is that
the same model is fit at every iteration in bootNet
. The only
time that models may differ across iterations is if a threshold
is
specified. When threshold = FALSE
, then the saturated model is fit to
each bootstrapped sample. Alternatively, bootstrapping can be performed with
respect to a specific constrained model. In this case, the constrained model
(variable selection model; output of varSelect
or
resample
) can be supplied to the type
argument, and thus
this function provides a way to estimate the posterior distributions of the
nodes based on a constrained model.
In addition to expanding bootnet
to handle moderated networks, there
are also some additional features such as the capacity to perform the block
bootstrap for temporal networks via the block
argument. The block
bootstrap is highly recommended for resampling temporal networks.
Another feature of this function is that it can be used on outputs from the
resample
function. This can be used as a way to evaluate the
iterations of resample
beyond just using it for variable
selection.
Value
A bootNet
object
Warning
Importantly, if output from the resample
function is used as
input for the bootNet
function, and the user wishes to use
the model selected by the resample
function as the comparison
to the bootstrapped results, you must add the fit0
argument to this
function. Use the fitted object in the resample
output as the
input for the undocumented fit0
argument for the
bootNet
function.
See Also
summary.bootNet, fitNetwork, varSelect,
resample, plotBoot, plotNet, net,
netInts
Examples
boot1 <- bootNet(ggmDat, 'M')
summary(boot1)
boot2 <- bootNet(gvarDat, 'M', lags = 1)
mod1 <- varSelect(gvarDat, 'M', lags = 1)
boot3 <- bootNet(gvarDat, 'M', lags = 1, type = mod1, caseDrop = TRUE)
summary(boot3)