permutationTest: Permutation test P-values for module preservation statistics

Description Usage Arguments Details References Examples

View source: R/pperm.R

Description

Evaluates the statistical significance of each module preservation test statistic for one or more modules.

Usage

1
2
3
4
5
6
7
permutationTest(
  nulls,
  observed,
  nVarsPresent,
  totalSize,
  alternative = "greater"
)

Arguments

nulls

a 3-dimension matrix where the columns correspond to module preservation statistics, rows correspond to modules, and the third dimension to null distribution observations drawn from the permutation procedure in modulePreservation.

observed

a matrix of observed values for each module preservation statistc (columns) for each module (rows) returned from modulePreservation.

nVarsPresent

a vector containing the number of variables/nodes in each module that was present in the test dataset. Returned as a list element of the same name by modulePreservation.

totalSize

the size of the test network used to perform the test. Returned as a list element of the same name by modulePreservation.

alternative

a character string specifying the alternative hypothesis, must be one of "greater" (default), "less", or "two.sided". You can specify just the initial letter.

Details

Calculates exact p-values for permutation tests when permutations are randomly drawn with replacement using the permp function in the statmod package.

This function may be useful for re-calculating permutation test P-values, for example when there are missing values due to sparse data. In this case the user may decide that these missing values should be assigned 0 so that P-values aren't signficant purely due to many incalculable statistics leading to low power.

References

  1. Phipson, B. & Smyth, G. K. Permutation P-values should never be zero: calculating exact P-values when permutations are randomly drawn. Stat. Appl. Genet. Mol. Biol. 9, Article39 (2010).

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
data("NetRep")

# Set up input lists for each input matrix type across datasets. The list
# elements can have any names, so long as they are consistent between the
# inputs.
network_list <- list(discovery=discovery_network, test=test_network)
data_list <- list(discovery=discovery_data, test=test_data)
correlation_list <- list(discovery=discovery_correlation, test=test_correlation)
labels_list <- list(discovery=module_labels)

# Note that we recommend running at least 10,000 permutations to make sure 
# that the null distributions are representative.

preservation <- modulePreservation(
 network=network_list, data=data_list, correlation=correlation_list, 
 moduleAssignments=labels_list, nPerm=1000, discovery="discovery", 
 test="test"
)

# Re-calculate the permutation test P-values
p.values <- permutationTest(
  preservation$nulls, preservation$observed, preservation$nVarsPresent,
  preservation$totalSize, preservation$alternative
)

InouyeLab/NetRep documentation built on Oct. 8, 2020, 2:32 a.m.