# NOT RUN {
# }
# NOT RUN {
## Load packages:
library("psych")
library("EstimateGroupNetwork")
# In this example, the BFI network of males and females are compared for the subset of
# Agreeableness items
# Load BFI data
data(bfi)
## The bfi data is subset to Agreeableness items only for the first 500 individuals to decrease
# computational time
bfi <- bfi[, c(paste("A", 1:5, sep = ""), "gender")]
# remove observations with missing values on items or gender
bfi <- na.omit(bfi)
# Create list split by gender
bfi_list <- list(males = bfi[bfi$gender == 1, 1:5],
females = bfi[bfi$gender == 2, 1:5])
# Estimate JGL:
bfi_net <- EstimateGroupNetwork(bfi_list, inputType = "list.of.dataframes", simplifyOutput = FALSE)
# Bootstrap network 10 times (this will take a few minutes)
boot_bfi_net <- GroupNetworkBoot(data_list = bfi_list, groupNetwork = bfi_net,
nboots = 10, bootSeed = 1234, ncores = 1)
# use BootTable to obtain a table with information for each boostrapped edge
BootTable(boot_bfi_net)
## Use GroupBootPlot to obtain plots as a list with each group plot as one element
GroupBootPlot(boot_bfi_net)
## Get plot for a subset of edges (here: all edges including A1). Also check Groupnames
GroupBootPlot(boot_bfi_net, edges.x = "A1", edges.y = c("A2", "A3", "A4", "A5"),
GroupNames = c("Females", "Males"), GroupNamesCheck = TRUE, legend.position = "top")
# }
Run the code above in your browser using DataLab