Generate GAM formula with factor-smooth interaction
This function will generate a formula in the following format:
y ~ orderedFactor + s(x) + s(x, by=orderedFactor),
factor.var - see
factor.var for more.
The formula generated could be further modified, e.g. adding covariates.
generator_gamFormula_factorXsmooth( response.var, factor.var, smooth.var, phenotypes, reference.group = NULL, prefix.ordered.factor = "o", fx = TRUE, k = NULL )
character class, the variable name for response
character class, the variable name for factor. It should be an ordered factor. If not, it will generate it as a new column in `phenotypes`, which requires `reference.group`.
character class, the variable name in smooth term as main effect
data.frame class, the cohort matrix with columns of independent variables (including
smooth.var) to be added to the model
character class, the reference group for ordered factor of `factor.var`; required when `factor.var` in `phenotypes` is not an ordered factor.
character class, the prefix for ordered factor; required when `factor.var` in `phenotypes` is not an ordered factor.
TRUE or FALSE, to be used in smooth term s(). Recommend TRUE.
integer, to be used in smooth term including the interaction term. If NULL (no entry), will use default value as in mgcv::s()