residual_gen( type ="lm", features =NULL, covariates =NULL, interaction =NULL, random =NULL, smooth =NULL, smooth_int_type =NULL, df, rm =NULL, model =FALSE, model_path =NULL, cores = detectCores())
Arguments
type: A model function name that is to be used (eg: "lmer", "lm", "gam").
features: The names of the features from which to extract residuals.
covariates: Name of covariates supplied to model.
interaction: Expression of interaction terms supplied to model (eg: "age,diagnosis").
random: Variable name of a random effect in linear mixed effect model.
smooth: Variable name that requires a smooth function.
smooth_int_type: Indicates the type of interaction in gam models. By default, smooth_int_type is set to be "linear", representing 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.
df: Harmonized dataset to extract residuals from.
rm: variables to remove effects from.
model: A boolean variable indicating whether an existing model is to be used.
model_path: path to the existing model.
cores: number of cores used for parallel computing.
Returns
residual_gen returns a list containing the following components: - model: a list of regression models for all rois
residual: Residual dataframe
Examples
features <- colnames(adni)[43:53]residual_gen(type ="lm", features = features,covariates = c("AGE","SEX","DIAGNOSIS"), df = adni, rm = c("AGE","SEX"), cores =1)