# Load data
wmt <- wmt2[,7:24]
# Set seed (to reproduce results)
set.seed(42)
# Split data
training <- sample(
1:nrow(wmt), round(nrow(wmt) * 0.80) # 80/20 split
)
# Set splits
wmt_train <- wmt[training,]
wmt_test <- wmt[-training,]
# EBICglasso (default for EGA functions)
glasso_network <- network.estimation(
data = wmt_train, model = "glasso"
)
# Check predictability
network.predictability(
network = glasso_network, original.data = wmt_train,
newdata = wmt_test
)
Run the code above in your browser using DataLab