nc_occ_probs {netcutter} | R Documentation |
Compute the occurrence probabilities
Description
Use the EdgeSwapping method to find the probability of occurrence of each term in each container under the null hypothesis.
Usage
nc_occ_probs(
occ_matrix,
R = 500,
S = sum(occ_matrix) * 10,
mc.cores = getOption("mc.cores", 1L),
n_batches = ceiling(R/30),
verbose = FALSE
)
Arguments
occ_matrix |
The original co-occurrence matrix |
R |
The number of randomisations to perform |
S |
The number of successful edge swaps for each randomisation |
mc.cores |
Number of parallel computations with mclapply() (set to 1 for serial execution) |
n_batches |
Split the computation into |
verbose |
Print a status message when starting every new batch. |
Value
The occurrence probability matrix.
Examples
# Generate an occurrence matrix.
m <- matrix(FALSE, 3, 9, dimnames = list(paste0("ID", 1:3), paste0("gene", 1:9)))
m[1, 1:3] <- m[2, c(1:2, 4:5)] <- m[3, c(1, 6:9)] <- TRUE
# Set the seed using the `rlecuyer` package
rlecuyer::.lec.SetPackageSeed(1:6)
# Compute the occurrence probabilities.
occ_probs <- nc_occ_probs(m, R = 20, S = 50)
# Using `n_batches=1` can speed up the computations at the cost of more RAM.
occ_probs <- nc_occ_probs(m, R = 20, n_batches = 1, mc.cores = 1)
[Package netcutter version 0.3.1 Index]