cpPermuteEntropy: Confidence Intervals Of Entropy Based On Random Permutations...

Description Usage Arguments Details Value Author(s) Examples

View source: R/cpPermuteEntropy.R

Description

Function for determining confidence intervals of entropy values calculated for community partition from clique percolation based on randomly permuted networks of original network.

Usage

1
2
3
4
5
6
7
cpPermuteEntropy(
  W,
  cpThreshold.object,
  n = 100,
  interval = 0.95,
  CFinder = FALSE
)

Arguments

W

A qgraph object; see also qgraph

cpThreshold.object

A cpThreshold object; see also cpThreshold

n

number of permutations (default is 100)

interval

requested confidence interval (larger than zero and smaller 1; default is 0.95)

CFinder

logical indicating whether clique percolation for weighted networks should be performed as in CFinder ; see also cpAlgorithm

Details

The function generates n random permutations of the network specified in W. For each randomly permuted network, it runs cpThreshold (see cpThreshold for more information) with k and I values extracted from the cpThreshold object specified in cpThreshold.object. Across permutations, the confidence intervals of the entropy values are determined for each k separately.

The confidence interval of the entropy values is determined separately for each k. This is because larger k have to produce less communities on average, which will decrease entropy. Comparing confidence intervals of smaller k to those of larger k would therefore be disadvantageous for larger k.

In the output, one can check the confidence intervals of each k. Moreover, a data frame is produced that takes the cpThreshold object that was specified in cpThreshold.object and removes all rows that do not exceed the upper bound of the confidence interval of the respective k.

Value

A list object with the following elements:

Confidence.Interval

a data frame with lower and upper bound of confidence interval for each k

Extracted.Rows

rows extracted from cpThreshold.object that are larger than the upper bound of the specified confidence interval for each k

Author(s)

Jens Lange, lange.jens@outlook.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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

set.seed(4186)
results <- cpPermuteEntropy(W = W, cpThreshold.object = cpThreshold.object,
                            n = 100, interval = 0.95)

# check results
results$Confidence.Interval
results$Extracted.Rows

chr1swallace/FasterCliquePercolation documentation built on Dec. 19, 2021, 3:59 p.m.