Learn R Programming

ComBatFamQC (version 1.0.5)

interaction_gen: Interaction Term Generation

Description

Generate appropriate interaction terms for regression models.

Usage

interaction_gen(
  type = "lm",
  covariates = NULL,
  smooth = NULL,
  interaction = NULL,
  smooth_int_type = NULL
)

Value

interaction_gen returns a list containing the following components:

interaction

A vector of interaction terms to be included

covariates

Modified covariates after expressing interaction terms

smooth

Modified smooth terms after expressing interaction terms

Arguments

type

The type of model to be used for batch effect evaluation or harmonization (eg: "lmer", "lm", "gam").

covariates

Name of covariates supplied to model.

smooth

Variable names that require a smooth function.

interaction

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

smooth_int_type

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.

Examples

Run this code
interaction_gen(type = "lm", covariates = c("AGE", "SEX", "DIAGNOSIS"),
interaction = "AGE,DIAGNOSIS")

interaction_gen(type = "gam", covariates = c("AGE", "SEX", "DIAGNOSIS"),
smooth = "AGE", smooth_int_type = "linear", interaction = "AGE,DIAGNOSIS")

Run the code above in your browser using DataLab