# BFI Extraversion data from psych package:
library("psych")
data(bfi)
bfiSub <- bfi[,11:15]
# 10 bootstraps (using Pearson correlations to speed up):
Results <- bootnet(bfiSub, nBoot = 5, default = "EBICglasso", prepFun = cor,
prepArgs = list(use = "pairwise.complete.obs"))
# Results:
print(Results)
# Estimated network:
plot(Results$sample, layout = 'spring')
# Estimated values in sample:
Results$sampleTable
# Estimated samples in bootstraps:
Results$bootTable
# Summary table:
summary(Results)
# Summary of strength only:
summary(Results, "strength")
# Plots of edges:
plot(Results, plot = "area", order = "sample")
plot(Results, plot = "interval", order = "sample")
#### Centrality ####
# Node-drop:
# 100 bootstraps (using Pearson correlations to speed up):
NodeDrop <- bootnet(bfiSub, nBoot = 25, default = "EBICglasso", prepFun = cor,
prepArgs = list(use = "pairwise.complete.obs"), type = "node")
# Person-drop:
PersonDrop <- bootnet(bfiSub, nBoot = 25, default = "EBICglasso", prepFun = cor,
prepArgs = list(use = "pairwise.complete.obs"), type = "node")
## Not run:
# # 1000 bootstraps (using Pearson correlations to speed up):
# NodeDrop <- bootnet(bfiSub, nBoot = 1000, default = "EBICglasso", prepFun = cor,
# prepArgs = list(use = "pairwise.complete.obs"), type = "node")
#
# # Person-drop:
# PersonDrop <- bootnet(bfiSub, nBoot = 1000, default = "EBICglasso", prepFun = cor,
# prepArgs = list(use = "pairwise.complete.obs"), type = "node")
# ## End(Not run)
# Plot:
plot(NodeDrop) # Correlation with original
plot(NodeDrop, perNode = TRUE) # Value per sampling level
plot(PersonDrop) # Correlation with original
plot(PersonDrop, perNode = TRUE) # Value per sampling level
Run the code above in your browser using DataLab