logratio_with_alpha: Perform log-ratio transformation with alpha parameter

View source: R/1a-propr-backend.R

logratio_with_alphaR Documentation

Perform log-ratio transformation with alpha parameter

Description

This function applies a log-ratio transformation to a given data matrix using an alpha parameter. The log-ratio transformation is based on a selected subset of columns specified by the 'use' argument. The transformation formula is: log(x/ref) = log(x) - log(ref) = [x^alpha-1]/alpha - [ref^alpha-1]/alpha, where x represents the data matrix and ref is the reference value calculated as the mean of the selected subset of columns.

Usage

logratio_with_alpha(ct, use, alpha)

Arguments

ct

A data matrix for which the log-ratio transformation will be performed. It is assumed that the matrix contains numerical values only.

use

An integer vector specifying the subset of columns to be used for the log-ratio transformation.

alpha

The alpha parameter used in the transformation.

Value

A matrix containing the log-ratio transformed data.

Examples

# Sample input data
data <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2, byrow = TRUE)

# Applying log-ratio transformation with alpha = 2 to rows using columns 2 and 3
result <- logratio_with_alpha(data, use = c(2, 3), alpha = 2)


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