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
8
9
cpPermuteEntropy(
  W,
  cpThreshold.object,
  n = 100,
  interval = 0.95,
  CFinder = FALSE,
  ncores,
  seed = NULL
)

Arguments

W

A qgraph object or a symmetric matrix; 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

ncores

Numeric. Number of cores to use in computing results. Defaults to parallel::detectCores() / 2 or half of your computer's processing power. Set to 1 to not use parallel computing

seed

Numeric. Set seed for reproducible results. Defaults to NULL

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

Settings

user-specified settings

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## 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

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

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

permute <- cpPermuteEntropy(net, cpThreshold.object = threshold,
                            interval = 0.99, n = 50, ncores = 1, seed = 4186)

# check results
permute

CliquePercolation documentation built on May 29, 2021, 5:07 p.m.