Description Usage Arguments Details Value See Also Examples
Estimate bias using the compositional least-squares approach described in McLaren, Willis, and Callahan (2019).
1 2 3 4 5 6 7 8 9 10 | estimate_bias(observed, actual, ...)
## S3 method for class 'matrix'
estimate_bias(observed, actual, margin, boot = FALSE, times = 1000)
## S3 method for class 'otu_table'
estimate_bias(observed, actual, ...)
## S3 method for class 'phyloseq'
estimate_bias(observed, actual, ...)
|
observed |
Abundance matrix of observed compositions. |
actual |
Abundance matrix of actual or reference compositions for the
same samples and taxa in |
... |
Arguments passed to the matrix method. |
margin |
Matrix margin that corresponds to observations (samples);
|
boot |
Whether to perform bootstrapping. |
times |
Number of bootstrap replicates. |
Bias is estimated by applying center() to the compositional error matrix
defined by observed/actual, which requires that observed and actual
are non-zero for the same sample-taxa pairs. For convenience, this
function will automatically set values in observed to 0 whose
corresponding entries are 0 in actual, but it is up to you to replace 0
values in observed with a non-zero value (such as a pseudocount).
Requirements for observed and actual: The row and column names (for
matrices) or taxa and sample names (for phyloseq objects) must match, but
can be in different orders. Any taxa and samples in observed but not in
actual will be dropped prior to estimation.
A mc_bias_fit object with coef(), fitted(), residuals(), and
summary() methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Load data from the cellular mock communities of Brooks et al 2015
dr <- system.file("extdata", package = "metacal")
list.files(dr)
actual <- file.path(dr, "brooks2015-actual.csv") |>
read.csv(row.names = "Sample") |>
as("matrix")
observed <- file.path(dr, "brooks2015-observed.csv") |>
read.csv(row.names = "Sample") |>
subset(select = - Other) |>
as("matrix")
sam <- file.path(dr, "brooks2015-sample-data.csv") |> read.csv()
# Estimate bias with bootstrapping for error estimation
mc_fit <- estimate_bias(observed, actual, margin = 1, boot = TRUE)
summary(mc_fit)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.