View source: R/causal_ccombat.R
cb.correct.aipw_cComBat | R Documentation |
A function for implementing the AIPW conditional ComBat (AIPW 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 could be argued to satisfy the ignorability condition) to derive causal conclusions. See citation for more details as to the conditions under which conclusions derived are causal.
cb.correct.aipw_cComBat(
Ys,
Ts,
Xs,
aipw.form,
covar.out.form = NULL,
retain.ratio = 0.05
)
Ys |
an |
Ts |
|
Xs |
|
aipw.form |
A covariate model, given as a formula. Applies for the estimation of propensities for the AIPW step. |
covar.out.form |
A covariate model, given as a formula. Applies for the outcome regression step of the |
retain.ratio |
If the number of samples retained is less than |
Note: This function is experimental, and has not been tested on real data. It has only been tested with simulated data with binary (0 or 1) exposures.
a list, containing the following:
Ys.corrected
an [m, d]
matrix, for the m
retained samples in d
dimensions, after correction.
Ts
[m]
the labels of the m
retained samples, with K < n
levels.
Xs
the r
covariates/confounding variables for each of the m
retained samples.
Model
the fit batch effect correction model.
Corrected.Ids
the ids to which batch effect correction was applied.
For more details see the help vignette:
vignette("causal_ccombat", package = "causalBatch")
Eric W. Bridgeford
Eric W. Bridgeford, et al. "A Causal Perspective for Batch Effects: When is no answer better than a wrong answer?" Biorxiv (2024).
W Evan Johnson, et al. "Adjusting batch effects in microarray expression data using empirical Bayes methods" Biostatistics (2007).
library(causalBatch)
sim <- cb.sims.sim_linear(a=-1, n=100, err=1/8, unbalancedness=2)
cb.correct.aipw_cComBat(sim$Ys, sim$Ts, data.frame(Covar=sim$Xs), "Covar")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.