Bootstrapped network estimation
This function can be used to bootstrap network estimation methods so that the spread of parameter and centrality estimates can be assessed. Most important methods are type = 'nonparametric'
for the non-parametric bootstrap and type = 'case'
for the case-dropping bootstrap. See also Epskamp, Borsboom and Fried (2016) for more details.
bootnet(data, nBoots = 1000, default = c("none", "EBICglasso", "ggmModSelect", "pcor", "IsingFit", "IsingSampler", "huge", "adalasso", "mgm", "relimp", "cor", "TMFG", "ggmModSelect", "LoGo", "SVAR_lavaan"), type = c("nonparametric", "parametric", "node", "person", "jackknife", "case"), nCores = 1, statistics = c("edge", "strength", "outStrength", "inStrength"), model = c("detect", "GGM", "Ising", "graphicalVAR"), fun, verbose = TRUE, labels, alpha = 1, caseMin = 0.05, caseMax = 0.75, caseN = 10, subNodes, subCases, computeCentrality = TRUE, propBoot = 1, replacement = TRUE, graph, sampleSize, intercepts, weighted, signed, directed, includeDiagonal = FALSE, communities = NULL, useCommunities = "all", library = .libPaths(), memorysaver = TRUE, ...)
data |
A data frame or matrix containing the raw data. Must be numeric, integer or ordered factors. |
nBoots |
Number of bootstraps |
default |
A string indicating the method to use. See documentation at |
type |
The kind of bootstrap method to use. |
nCores |
Number of cores to use in computing results. Set to 1 to not use parallel computing. |
statistics |
Vector indicating which statistics to store. Options are:
Can contain |
model |
The modeling framework to use. Automatically detects if data is binary or not. |
fun |
A custom estimation function, when no default set is used. This must be a function that takes the data as input (first argument) and returns either a weights matrix or a list containing the elements |
verbose |
Logical. Should progress of the function be printed to the console? |
labels |
A character vector containing the node labels. If omitted the column names of the data are used. |
alpha |
The centrality tuning parameter as used in |
subNodes |
Range of nodes to sample in node-drop bootstrap |
caseMin |
Minimum proportion of cases to drop when |
caseMax |
Maximum proportion of cases to drop when |
caseN |
Number of sampling levels to test when |
subCases |
Range of persons to sample in person-drop bootstrap |
computeCentrality |
Logical, should centrality be computed? |
propBoot |
Proportion of persons to sample in bootstraps. Set to lower than 1 for m out of n bootstrap |
replacement |
Logical, should replacement be used in bootstrap sampling? |
graph |
A given network structure to use in parametric bootstrap. |
sampleSize |
The samplesize to use in parametric bootstrap. |
intercepts |
Intercepts to use in parametric bootstrap. |
weighted |
Logical, should the analyzed network be weighted? |
signed |
Logical, should the analyzed network be signed? |
directed |
Logical, is the analyzed network directed? Usually does not have to be set and is detected automatically. |
includeDiagonal |
Logical, should diagonal elements (self-loops) be included in the bootstrap? Only used when |
communities |
Used for bridge centrality measures (see |
useCommunities |
Used for bridge centrality measures (see |
library |
Library location to be used in parallel computing. |
memorysaver |
Logical. If TRUE (recommended) then raw bootstrapped data and results are not stored in the output object. This saves a lot of memory. Set this only to TRUE if you need the raw results or bootstrap data. |
... |
Additional arguments used in the estimator function. |
A bootnet
object with the following elements:
sampleTable |
A data frame containing all estimated values on the real sample. |
bootTable |
A data frame containing all estimated values on all bootstrapped samples. |
sample |
A |
boots |
A list of |
Sacha Epskamp <mail@sachaepskamp.com>
Epskamp, S., Borsboom, D., & Fried, E. I. (2018). Estimating psychological networks and their accuracy: A tutorial paper. Behavior Research Methods, 50(1), 195-212.
# BFI Extraversion data from psychTools package: library("psychTools") data(bfi) bfiSub <- bfi[,1:25] # Estimate network: Network <- estimateNetwork(bfiSub, default = "EBICglasso") # Centrality indices: library("qgraph") centralityPlot(Network) ## Not run: # Estimated network: plot(Network, layout = 'spring') ### Non-parametric bootstrap ### # Bootstrap 1000 values, using 8 cores: Results1 <- bootnet(Network, nBoots = 1000, nCores = 8) # Plot bootstrapped edge CIs: plot(Results1, labels = FALSE, order = "sample") # Plot significant differences (alpha = 0.05) of edges: plot(Results1, "edge", plot = "difference",onlyNonZero = TRUE, order = "sample") # Plot significant differences (alpha = 0.05) of node strength: plot(Results1, "strength", plot = "difference") # Test for difference in strength between node "A1" and "C2": differenceTest(Results, "A1", "C2", "strength") ### Case-drop bootstrap ### # Bootstrap 1000 values, using 8 cores: Results2 <- bootnet(Network, nBoots = 1000, nCores = 8, type = "case") # Plot centrality stability: plot(Results2) # Compute CS-coefficients: corStability(Results2) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.