View source: R/2a-propd-backend.R
calculate_theta | R Documentation |
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).
calculate_theta(
counts,
group,
alpha = NA,
lrv = NA,
only = "all",
weighted = FALSE,
weights = as.matrix(NA)
)
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'. |
A data frame containing the computed theta values and related statistics, depending on the 'only' parameter.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.