randomizedRRR {SPECK} | R Documentation |
Reduced rank reconstruction (RRR) of a matrix.
Description
Computes the rank and subsequent RRR of a counts matrix. Log-normalization is first performed
using the
Seurat::NormalizeData()
function. RRR is next performed on the normalized
matrix using randomized Singular Value Decomposition with the
rsvd::rsvd()
function. Estimated rank is selected via a
construction of the standard deviations of non-centered sample principal components, which are used in a subsequent rate of change computation
where each successive standard deviation value is compared to the previous to determine the rank at which the absolute value of the rate of change
between consecutive values is at least 0.01 for at least two value pairs.
Usage
randomizedRRR(
counts.matrix,
rank.range.end = 100,
min.consec.diff = 0.01,
rep.consec.diff = 2,
manual.rank = NULL,
seed.rsvd = 1
)
Arguments
counts.matrix |
A |
rank.range.end |
Upper value of the rank for RRR. |
min.consec.diff |
Minimum difference in the rate of change between a pair of successive standard deviation estimate. |
rep.consec.diff |
Frequency of the minimum difference in the rate of change between a pair of successive standard deviation estimate. |
manual.rank |
Optional, user-specified upper value of the rank used for RRR as an alternative to automatically computed rank. |
seed.rsvd |
Seed specified to ensure reproducibility of the RRR. |
Value
rrr.mat - A
RRR matrix.
rrr.rank - Automatically computed rank.
component.stdev - A vector corresponding to standard deviations of non-centered sample principal components.
Examples
set.seed(10)
data.mat <- matrix(data = rbinom(n = 18400, size = 230, prob = 0.2), nrow = 80)
rrr.object <- randomizedRRR(counts.matrix = data.mat, rank.range.end = 60,
min.consec.diff = 0.01, rep.consec.diff = 2,
manual.rank = NULL, seed.rsvd = 1)
print(rrr.object$component.stdev)
print(rrr.object$rrr.rank)
dim(rrr.object$rrr.mat); str(rrr.object$rrr.mat)