Implementation of the ComBat Family of harmonization methods allowing for flexible covariate modeling and alternative estimators for site effect adjustment. Support for modeling of both location and scale via GAMLSS and longitudinal harmonization via mixed effects models.
comfam( data, bat, covar =NULL, model = lm, formula =NULL, eb =TRUE, robust.LS =FALSE, ref.batch =NULL,...)
Arguments
data: n x p data frame or matrix of observations where p is the number of features and n is the number of subjects.
bat: Factor indicating batch (often equivalent to site or scanner)
covar: Data frame or matrix of covariates supplied to model
model: Model function. ComBat Family supports any models that take arguments formula and data, but are limited to models fitting with identity link (e.g. family = gaussian(link = "identity")). This includes lm , gam , gamlss , rq , lmer , and more
formula: Formula for model starting with y ~ where y represents each feature
eb: If TRUE, uses ComBat model with empirical Bayes for mean and variance harmonization
robust.LS: If TRUE, uses robust location and scale estimators for error variance and site effect parameters. Currently uses median and biweight midvariance
ref.batch: Reference batch, must take value in levels(bat)
...: Additional arguments to model
Returns
comfam returns a list containing the following components: - dat.combat: Harmonized data as a matrix with same dimensions as data
batch.info: Batch information, including reference batch if specified
fits: List of model fits from regression step, outputs of model for each feature
estimates: List of estimates from standardization and batch effect correction
Examples
comfam(iris[,1:2], iris$Species)comfam(iris[,1:2], iris$Species, iris[3:4], lm, y ~ Petal.Length + Petal.Width)
See Also
predict.comfam for applying ComBat parameters for harmonization of new observations