cb.correct.caus_cComBat {causalBatch} | R Documentation |
Causal Conditional ComBat
Description
A function for implementing the causal conditional ComBat (causal cComBat) algorithm. This algorithm allows users to remove batch effects (in each dimension), while adjusting for known confounding variables. It is imperative that this function is used in conjunction with domain expertise (e.g., to ensure that the covariates are not colliders, and that the system satisfies the strong ignorability condiiton) to derive causal conclusions. See citation for more details as to the conditions under which conclusions derived are causal.
Usage
cb.correct.caus_cComBat(
Ys,
Ts,
Xs,
match.form,
reference = NULL,
match.args = list(method = "nearest", exact = NULL, replace = FALSE, caliper = 0.1),
retain.ratio = 0.05
)
Arguments
Ys |
an |
Ts |
|
Xs |
|
match.form |
A formula of columns from |
reference |
the name of the reference/control batch, against which to match. Defaults to |
match.args |
A named list arguments for the |
retain.ratio |
If the number of samples retained is less than |
Value
a list, containing the following:
Ys.corrected
an[m, d]
matrix, for them
retained samples ind
dimensions, after correction.Ts
[m]
the labels of them
retained samples, withK < n
levels.Xs
ther
covariates/confounding variables for each of them
retained samples.Retained.Ids
a[m]
vector consisting of the sample ids of then
original samples that were retained after matching.
Details
For more details see the help vignette:
vignette("causal_ccombat", package = "causalBatch")
Author(s)
Eric W. Bridgeford
References
Eric W. Bridgeford, et al. "A Causal Perspective for Batch Effects: When is no answer better than a wrong answer?" Biorxiv (2024).
Daniel E. Ho, et al. "MatchIt: Nonparametric Preprocessing for Parametric Causal Inference" JSS (2011).
W Evan Johnson, et al. "Adjusting batch effects in microarray expression data using empirical Bayes methods" Biostatistics (2007).
Examples
library(causalBatch)
sim <- cb.sims.sim_linear(a=-1, n=100, err=1/8, unbalancedness=3)
cb.correct.caus_cComBat(sim$Ys, sim$Ts, data.frame(Covar=sim$Xs), "Covar")