calculate_theta: Calculate Theta and Related Statistics

View source: R/2a-propd-backend.R

calculate_thetaR Documentation

Calculate Theta and Related Statistics

Description

This function calculates theta and related statistics based on the input count matrix and other parameters. The function provides various options for calculating theta (theta_d, theta_e, theta_f, theta_g).

Usage

calculate_theta(
  counts,
  group,
  alpha = NA,
  lrv = NA,
  only = "all",
  weighted = FALSE,
  weights = as.matrix(NA)
)

Arguments

counts

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

group

A character vector representing group labels indicating the assignment of each count to different groups.

alpha

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

lrv

If LRV is provided, it is not computed within the function.

only

A character vector specifying the type of theta to calculate.

weighted

A logical value indicating whether weighted calculations should be performed. If 'TRUE', the function will use limma-based weights for the calculations.

weights

A matrix of limma-based weights. This parameter is optional and used only if 'weighted = TRUE'.

Value

A data frame containing the computed theta values and related statistics, depending on the 'only' parameter.

Examples

# Sample input count data and group assignments
data <- iris[1:100, 1:4]
group <- iris[1:100, 5]

# Calculate all theta types
result_all <- calculate_theta(data, group, alpha = 0.5)

# Calculate only theta_d
result_theta_d <- calculate_theta(data, group, alpha = 0.5, only = "theta_d")


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