sccomp_remove_unwanted_variation | R Documentation |
This function uses the model to remove unwanted variation from a dataset using the estimates of the model. For example, if you fit your data with the formula ~ factor_1 + factor_2
and use the formula ~ factor_1
to remove unwanted variation, the factor_2
effect will be factored out.
sccomp_remove_unwanted_variation(
.data,
formula_composition_keep = NULL,
formula_composition = NULL,
formula_variability = NULL,
cores = detectCores()
)
.data |
A tibble. The result of |
formula_composition_keep |
A formula. The formula describing the model for differential abundance, for example |
formula_composition |
DEPRECATED. Use |
formula_variability |
DEPRECATED. Use |
cores |
Integer, the number of cores to be used for parallel calculations. |
A tibble (tbl
) with the following columns:
sample - A character column representing the sample name for which data was adjusted.
cell_group - A character column representing the cell group being tested.
adjusted_proportion - A numeric column representing the adjusted proportion after removing unwanted variation.
adjusted_counts - A numeric column representing the adjusted counts after removing unwanted variation.
logit_residuals - A numeric column representing the logit residuals calculated after adjustment.
message("Use the following example after having installed cmdstanr with install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
if (instantiate::stan_cmdstan_exists()) {
data("counts_obj")
estimates = sccomp_estimate(
counts_obj,
~ type, ~1, sample, cell_group, count,
cores = 1
) |>
sccomp_remove_unwanted_variation()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.