Bootstrapped network estimation

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
bootnet(data, nBoots = 1000, default = c("none", "EBICglasso",
                 "pcor", "IsingFit", "IsingLL"), type =
                 c("nonparametric", "parametric", "node", "person",
                 "jackknife", "case"), nCores = 1, statistics = c("edge"
                 ,"strength","closeness","betweenness"), model = c("detect",
                 "GGM", "Ising"), prepFun, prepArgs, estFun, estArgs,
                 graphFun, graphArgs, intFun, intArgs, verbose = TRUE,
                 labels, alpha = 1, subNodes = 2:(ncol(data) - 1),
                 subPersons = round(seq(0.25, 0.95, length = 10) *
                 nrow(data)), computeCentrality = TRUE, propBoot = 1,
                 replacement = TRUE, graph, sampleSize, intercepts)

Arguments

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 estimateNetwork.

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. Can contain "edge", "strength", "closeness", "betweenness", "length" and "distance". By default, length and distance are not stored.

model

The modeling framework to use. Automatically detects if data is binary or not.

prepFun

See documentation at estimateNetwork.

prepArgs

See documentation at estimateNetwork.

estFun

See documentation at estimateNetwork.

estArgs

See documentation at estimateNetwork.

graphFun

See documentation at estimateNetwork.

graphArgs

See documentation at estimateNetwork.

intFun

See documentation at estimateNetwork.

intArgs

See documentation at estimateNetwork.

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 centrality.

subNodes

Range of nodes to sample in node-drop bootstrap

subPersons

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.

Value

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 bootnetResult object with plot and print method containing the estimated network of the real sample.

boots

A list of bootnetResult objects containing the raw bootstrap results.

Author(s)

Sacha Epskamp <mail@sachaepskamp.com>

References

Epskamp, S., Borsboom, D., & Fried, E. I. (2016). Estimating psychological networks and their accuracy: a tutorial paper. arXiv preprint, arXiv:1604.08462.

See Also

estimateNetwork, differenceTest, corStability, plot.bootnet, summary.bootnet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# BFI Extraversion data from psych package:
library("psych")
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)