visual_prep: Batch Effect Diagnostic Visualization Preparation

View source: R/visual_prep.R

visual_prepR Documentation

Batch Effect Diagnostic Visualization Preparation

Description

Prepare relevant datasets and statistical test results for batch/site effect diagnostic visualization.

Usage

visual_prep(
  type = "lm",
  features,
  batch,
  covariates = NULL,
  interaction = NULL,
  random = NULL,
  smooth = NULL,
  smooth_int_type = NULL,
  df,
  cores = detectCores(),
  mdmr = TRUE
)

Arguments

type

The name of a regression model to be used in batch effect diagnostics stage: "lmer", "lm", "gam".

features

The name of the features to be evaluated.

batch

The name of the batch variable.

covariates

Name of covariates supplied to model.

interaction

Expression of interaction terms supplied to model (eg: "age,diagnosis").

random

Variable name of a random effect in linear mixed effect model.

smooth

Variable name that requires a smooth function.

smooth_int_type

Indicates the type of interaction in gam models. By default, smooth_int_type is set to be "linear", representing 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.

df

Dataset to be evaluated.

cores

number of cores used for parallel computing.

mdmr

A boolean variable indicating whether to run the MDMR test (default: TRUE).

Value

visual_prep returns a list containing the following components:

residual_add_df

Residuals that might contain additive and multiplicative joint batch effects

residual_ml_df

Residuals that might contain multiplicative batch effect

pr.feature

PCA results

pca_summary

A dataframe containing the variance explained by Principal Components (PCs)

pca_df

A dataframe contains features in the form of PCs

tsne_df

A dataframe prepared for T-SNE plots

kr_test_df

A dataframe contains Kenward-Roger(KR) test results

fk_test_df

A dataframe contains Fligner-Killeen(FK) test results

mdmr.summary

A dataframe contains MDMR results

anova_test_df

A dataframe contains ANOVA test results

kw_test_df

A dataframe contains Kruskal-Wallis test results

lv_test_df

A dataframe contains Levene's test results

bl_test_df

A dataframe contains Bartlett's test results

red

A parameter to highlight significant p-values in result table

info

A list contains input information like batch, covariates, df etc

Examples

visual_prep(type = "lm", features = colnames(adni)[43:53], batch = "manufac",
covariates = c("AGE", "SEX", "DIAGNOSIS"), df = head(adni, 500), cores = 1)


ComBatFamQC documentation built on April 4, 2025, 12:24 a.m.