If a linear mixed model is used, all categorical variables must be modeled as a random effect. This function identifies the variable class to scale numeric variables and model categorical variables as a random effect. Additionally, variables are scaled to account for multiple variables that might have an order of magnitude difference.

build_formula(
  md,
  primary_variable,
  model_variables = NULL,
  is_num = NULL,
  num_var = NULL,
  random_effect = NULL,
  exclude_variables = NULL,
  add_model = NULL
)

Arguments

md

A data frame with sample identifiers in a column and relevant experimental covariates.

primary_variable

Vector of variables that will be collapsed into a single fixed effect interaction term.

model_variables

Optional. Vector of variables to include in the linear (mixed) model. If not supplied, the model will include all variables in md.

is_num

Is there a numerical covariate to use as an interaction with the primary variable(s). default= NULL

num_var

A numerical metadata column to use in an inaction with the primary variable(s). default= NULL

random_effect

A vector of variables to consider as random effects instead of fixed effects.

exclude_variables

Vector of variables to exclude from testing.

add_model

Optional. User Speciffied variables to add to the null model apriori to model generation. (Default = NULL)