permutationTest: Permutation test P-values for module preservation statistics

View source: R/pperm.R

permutationTestR Documentation

Permutation test P-values for module preservation statistics

Description

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

Usage

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

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
)


NetRep documentation built on Aug. 19, 2023, 5:07 p.m.