Estimate bias using the compositional least-squares approach described in McLaren, Willis, and Callahan (2019).
estimate_bias(observed, actual, ...) # S3 method for matrix estimate_bias(observed, actual, margin, boot = FALSE, times = 1000) # S3 method for otu_table estimate_bias(observed, actual, ...) # S3 method for 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. |
A mc_bias_fit
object with coef()
, fitted()
, residuals()
, and
summary()
methods.
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).
Name 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.