# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab