interaction_gen function

Interaction Term Generation

Interaction Term Generation

Generate appropriate interaction terms for regression models.

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.

Returns

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