propr-class | R Documentation |
Welcome to the propr
package!
To learn more about calculating proportionality, see Details.
To learn more about differential proportionality, see
propd
.
To learn more about compositional data analysis, see
citation("propr")
.
## S4 method for signature 'propr'
show(object)
propr(
counts,
metric = c("rho", "phi", "phs", "cor", "vlr", "ppcor", "pcor", "pcor.shrink",
"pcor.bshrink"),
ivar = "clr",
select = NA,
symmetrize = FALSE,
alpha = NA,
p = 0
)
object |
A |
counts |
A data matrix representing counts. It is assumed that the matrix contains numerical values only. |
metric |
A character vector indicating the metric used for computing the association matrix. It can take the following values: - "rho": Propr matrix based on the rho coefficient. - "phi": Propr matrix based on the phi coefficient. - "phs": Propr matrix based on the symmetric phi coefficient. - "cor": Propr matrix based on the simple Pearson correlation coefficient. - "vlr": Propr matrix based on the variance of log-ratio (VLR). - "pcor": Propr matrix based on the partial correlation coefficient (using ppcor package). - "pcor.shrink": Propr matrix based on the shrinkage-estimated partial correlation coefficient (using corpcor package). - "pcor.bshrink": Propr matrix based on the partial correlation coefficient with basis shrinkage (ivar argument must be 'clr' or 'alr'). |
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) or index(es) of variable(s) to use as a reference. - Use NA to skip log-ratio transformation and any other pre-processing, like zero replacement. This is useful when the input data is already pre-processed. |
select |
A numeric vector representing the indices of features to be used for computing the Propr matrix. This argument is optional. If provided, it reduces the data size by using only the selected features. |
symmetrize |
A logical value indicating whether to force symmetry in the output Propr matrix when the metric is "phi". If 'TRUE', the function will symmetrize the matrix; otherwise, it will return the original matrix. |
alpha |
The alpha parameter used in the alpha log-ratio transformation. |
p |
The number of permutations to perform for calculating the false discovery rate (FDR). The default is 0. |
The function performs log-ratio transformation and computes a Propr matrix using different measures of association.
A propr object containing the Propr matrix, associated log-ratio transformation, and other calculated statistics.
counts
A data.frame. Stores the original "count matrix" input.
alpha
A double. Stores the alpha value used for transformation.
metric
A character string. The metric used to calculate proportionality.
ivar
A vector. The reference used to calculate proportionality.
logratio
A data.frame. Stores the transformed "count matrix".
matrix
A matrix. Stores the proportionality matrix.
pairs
A vector. Indexes the proportional pairs of interest.
results
A data.frame. Stores the pairwise propr
measurements.
permutes
A list. Stores the shuffled transformed "count matrix"
instances, used to reproduce permutations of propr
.
fdr
A data.frame. Stores the FDR cutoffs for propr
.
show:
Method to show propr
object.
# Sample input count data
data <- matrix(c(10, 5, 15, 20, 30, 25), nrow = 2, byrow = TRUE)
# Calculate Propr matrix using correlation coefficient
result_cor <- propr(data, metric = "cor", ivar = "clr")
# Calculate Propr matrix using variance of log-ratio (VLR)
result_vlr <- propr(data, metric = "vlr", ivar = "clr")
# Calculate Propr matrix using partial correlation coefficient
result_pcor <- propr(data, metric = "pcor", ivar = "clr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.