This function acts as a dispatcher, calling the appropriate helper (lm_anv_p_and_d or lmer_anv_p_and_d) based on whether the analysis is specified as longitudinal. It extracts key metrics and displays a progress bar.

run_association_analysis(
  data,
  predictors,
  outcomes,
  covariates,
  dataset_name,
  analysis_type = "Cross-Sectional",
  use_delta_outcome = TRUE,
  random_effects = "(1 | PTID)"
)

Arguments

data

The dataframe containing all variables.

predictors

A character vector of predictor column names.

outcomes

A character vector of outcome column names.

covariates

A character string of covariates.

dataset_name

A string to label the results.

analysis_type

A string, either "Cross-Sectional" or "Longitudinal".

use_delta_outcome

A logical value. If TRUE (default), appends "_delta" to the outcome variable for longitudinal analyses.

random_effects

A string for the random effects part of the LMER formula.

Value

A tidy data frame with results for every predictor-outcome pair.