Conduct harmonization using four types of methods: 1) Original ComBat, 2) Longitudinal ComBat, 3) ComBat-GAM, and 4) CovBat.
combat_harm(
eb_check = FALSE,
result = NULL,
features = NULL,
batch = NULL,
covariates = NULL,
df = NULL,
type = "lm",
random = NULL,
smooth = NULL,
interaction = NULL,
smooth_int_type = NULL,
family = "comfam",
eb = TRUE,
ref.batch = NULL,
predict = FALSE,
object = NULL,
reference = NULL,
out_ref_include = TRUE,
...
)
If the eb_check
is set to be FALSE, then combat_harm
returns a list containing the following components:
ComBat family to be considered: comfam, covfam
Harmonized dataset
Saved ComBat model and relevant information, such as the batch variable name and whether the EB method is used
If eb_check
is set to be TRUE, then combat_harm
will return a dataframe with the EB assumption test result.
A boolean variable indicating whether the user wants to run the EB assumption test before harmonization.
A list derived from visual_prep()
that contains dataset and batch effect diagnostic information for Shiny visualization. Can be skipped if features
, batch
, covariates
and df
are provided.
The name of the features to be harmonized. This can be skipped if result
is provided.
The name of the batch variable. Can be skipped if result
is provided.
The names of covariates supplied to model
. This can be be skipped if result
is provided.
Dataset to be harmonized. This can be be skipped if result
is provided.
The name of a regression model to be used: "lmer"
, "lm"
, "gam"
.
The variable name of a random effect in linear mixed effect model.
The name of the covariates that require a smooth function.
Expression of interaction terms supplied to model
(eg: "age,diagnosis"
).
A vector that indicates the types of interaction in gam
models. By default, smooth_int_type
is set to be NULL, "linear"
represents linear interaction terms.
"categorical-continuous"
, "factor-smooth"
both represent categorical-continuous interactions ("factor-smooth"
includes categorical variable as part of the smooth),
"tensor"
represents interactions with different scales, and "smooth-smooth" represents interaction between smoothed variables.
The type of combat family to use, comfam
or covfam
.
If TRUE
, uses ComBat model with empirical Bayes for mean and variance harmonization
The name of the reference batch.
A boolean variable indicating whether to run ComBat from scratch or apply existing model to new dataset (currently only work for original ComBat and ComBat-GAM).
Existing ComBat model.
Dataset to be considered as the reference group.
A boolean variable indicating whether the reference data should be included in the harmonized data output.
Additional arguments to comfam
or covfam
models.
combat_harm(features = colnames(adni)[43:53], batch = "manufac",
covariates = c("AGE", "SEX", "DIAGNOSIS"), df = head(adni,100), type = "lm")
Run the code above in your browser using DataLab