Learn R Programming

molnet (version 0.1.0)

pickHardThreshold_alternative: Alternative implementation of WGCNA::pickHardThreshold

Description

(INTERNAL) Alternative implementation of pickHardThreshold to fit to the needs of this package. Most importantly the function was simplified to only apply to the use case of finding a cut-off value to reduce a correlation matrix. The following changes were applied in comparison to the original function: * The function __always__ assumes similarity matrices (i.e. correlation matrices) as input * Additional settings have been removed (`dataIsExpr`, `moreNetworkConcepts`, `removeFirst`, `corFnc`, `corOptions`, `nBreaks`) * The function uses scaleFreeFitIndex_alternative for fit index calculation * Print prompts and additional metrics were removed * An error message that reports the lowest R-squared computed in case this value did not satisfy the RsquaredCut value was added.

Description by pickHardThreshold:Analysis of scale free topology for multiple hard thresholds. The aim is to help the user pick an appropriate threshold for network construction.

Usage

pickHardThreshold_alternative(
  data,
  RsquaredCut = 0.85,
  cutVector = seq(0.1, 0.9, by = 0.05)
)

Arguments

data

Similarity (correlation) matrix. With entries between 0 and 1 (i.e. absolute values of correlation matrix)

RsquaredCut

desired minimum scale free topology fitting index

cutVector

a vector of hard threshold cuts for which the scale free topology fit indices are to be calculated.

Value

estimate of an appropriate hard-thresholding cut: the lowest cut for which the scale free topology fit exceeds RsquaredCut. If is below RsquaredCut for all cuts, an error is thrown.

Examples

Run this code
# NOT RUN {
adjacency_matrix <- matrix(rnorm(36),nrow=6)
diag(adjacency_matrix) <- 1
RsquaredCut <- 0.001
cutVector <- seq(0.2, 0.8, by = 0.05)
# }
# NOT RUN {
cutEstimate_coarse <- pickHardThreshold_alternative(abs(adjacency_matrix), RsquaredCut,
cutVector)
# }

Run the code above in your browser using DataLab