## Example with fictitious data
# create qgraph object
W <- matrix(c(0,1,1,1,0,0,0,0,
0,0,1,1,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,1,1,1,0,
0,0,0,0,0,1,1,0,
0,0,0,0,0,0,1,0,
0,0,0,0,0,0,0,1,
0,0,0,0,0,0,0,0), nrow = 8, ncol = 8, byrow = TRUE)
W <- Matrix::forceSymmetric(W)
W <- qgraph::qgraph(W)
# create cpThreshold object
cpThreshold.object <- cpThreshold(W = W, method = "unweighted", k.range = c(3,4),
threshold = "entropy")
# run cpPermuteEntropy with 100 permutations and 95% confidence interval
# \donttest{
results <- cpPermuteEntropy(W = W, cpThreshold.object = cpThreshold.object,
n = 100, interval = 0.95, ncores = 1, seed = 4186)
# check results
results
# }
## Example with Obama data set (see ?Obama)
# get data
data(Obama)
# estimate network
net <- qgraph::EBICglasso(qgraph::cor_auto(Obama), n = nrow(Obama))
# create cpThreshold object
# \donttest{
threshold <- cpThreshold(net, method = "weighted",
k.range = 3:4,
I.range = seq(0.1, 0.5, 0.01),
threshold = "entropy")
# }
# run cpPermuteEntropy with 50 permutations and 99% confidence interval
# \donttest{
permute <- cpPermuteEntropy(net, cpThreshold.object = threshold,
interval = 0.99, n = 50, ncores = 1, seed = 4186)
# check results
permute
# }
Run the code above in your browser using DataLab