cb.detect.caus_cdcorr {causalBatch} | R Documentation |
Causal Conditional Distance Correlation
Description
A function for implementing the causal conditional distance correlation (causal cDCorr) algorithm. This algorithm allows users to identify whether a treatment causes changes in an outcome, given assorted covariates/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.detect.caus_cdcorr(
Ys,
Ts,
Xs,
R = 1000,
dist.method = "euclidean",
distance = FALSE,
seed = 1,
num.threads = 1,
retain.ratio = 0.05,
ddx = FALSE
)
Arguments
Ys |
Either:
|
Ts |
|
Xs |
|
R |
the number of repetitions for permutation testing. Defaults to |
dist.method |
the method used for computing distance matrices. Defaults to |
distance |
a boolean for whether (or not) |
seed |
a random seed to set. Defaults to |
num.threads |
The number of threads for parallel processing (if desired). Defaults to |
retain.ratio |
If the number of samples retained is less than |
ddx |
whether to show additional diagnosis messages. Defaults to |
Value
a list, containing the following:
Test
The outcome of the statistical test, fromcdcov.test
.Retained.Ids
The sample indices retained after vertex matching, which correspond to the samples for which statistical inference is performed.
Details
For more details see the help vignette:
vignette("causal_cdcorr", 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).
Eric W. Bridgeford, et al. "Learning sources of variability from high-dimensional observational studies" arXiv (2023).
Xueqin Wang, et al. "Conditional Distance Correlation" American Statistical Association (2015).
Examples
library(causalBatch)
sim <- cb.sims.sim_linear(a=-1, n=100, err=1/8, unbalancedness=3)
cb.detect.caus_cdcorr(sim$Ys, sim$Ts, sim$Xs)