selectReference: Select Optimal Reference Component

View source: R/5-selectReference.R

selectReferenceR Documentation

Select Optimal Reference Component

Description

This function selects the optimal reference component from the log-ratio transformed data matrix based on the provided ivar (index variable) and alpha values.

Usage

selectReference(counts, ivar, alpha)

Arguments

counts

A data matrix representing counts. It is assumed that the matrix contains numerical values only.

ivar

An indicator specifying the method for log-ratio transformation. It can take the following values: - "clr" (default): Centered log-ratio transformation. - "alr": Additive log-ratio transformation ("pcor.bshrink" metric only). - "iqlr": Inter-quartile log-ratio transformation from ALDEx2. - The explicit name(s) of variable(s) to use as a reference. Use NA to skip log-ratio transformation.

alpha

The alpha parameter used in the alpha log-ratio transformation.

Details

The function transforms the input counts matrix into log space using the logratio function. Then, it calculates the variance of each component and identifies the component with the minimum variance, which is considered the optimal reference.

Value

The column name or index of the optimal reference component.

Examples

# Sample counts matrix
counts_matrix <- matrix(c(10, 20, 30, 40, 0, 50, 60, 70, 0), nrow = 3, byrow = TRUE)
colnames(counts_matrix) <- c("A", "B", "C")
rownames(counts_matrix) <- c("Sample1", "Sample2", "Sample3")

# Select optimal reference component
selectReference(counts_matrix, ivar = "A", alpha = 0.5)


tpq/propr documentation built on April 21, 2024, 12:50 p.m.