cb.correct.apply_aipw_cComBat: Fit AIPW ComBat model for batch effect correction

View source: R/aipw_ccombat_helpers.R

cb.correct.apply_aipw_cComBatR Documentation

Fit AIPW ComBat model for batch effect correction

Description

This function applies an Augmented Inverse Probability Weighting (AIPW) ComBat model for batch effect correction to new data.

Usage

cb.correct.apply_aipw_cComBat(Ys, Ts, Xs, Model)

Arguments

Ys

an [n, d] matrix, for the outcome variables with n samples in d dimensions.

Ts

[n] the labels of the samples, with K < n levels, as a factor variable.

Xs

[n, r] the r covariates/confounding variables, for each of the n samples, as a data frame with named columns.

Model

a list containing the following parameters:

  • Prop_model Fitted propensity model

  • Putcome_models List of fitted outcome models for each feature and treatment level

  • Levels Levels of the treatment factor

  • Treatment_effects Estimated treatment effects

  • AIPW_est AIPW estimator results

  • covar.out.form Formula used for the outcome model

This model is output after fitting with cb.correct.aipw_cComBat.

Details

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.

Value

an [n, d] matrix, the batch-effect corrected data.

Examples

library(causalBatch)
sim <- cb.sims.sim_linear(a=-1, n=200, err=1/8, unbalancedness=3)
# fit batch effect correction for first 100 samples
cb.fit <- cb.correct.matching_cComBat(sim$Ys[1:100,,drop=FALSE], sim$Ts[1:100], 
                                  data.frame(Covar=sim$Xs[1:100,,drop=FALSE]), "Covar")
# apply to all samples
cor.dat <- cb.correct.apply_cComBat(sim$Ys, sim$Ts, data.frame(Covar=sim$Xs), cb.fit$Model)


causalBatch documentation built on April 3, 2025, 8:38 p.m.