interaction_gen: Interaction Term Generation

View source: R/Help_Func.R

interaction_genR Documentation

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
)

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.

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

Examples

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")


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