This function creates a graphical representation of regression results using either an igraph-based network plot (with modern styling), a Sankey diagram, or an alluvial diagram.

plot_regression_graph(
  predictors,
  weights,
  outcome,
  method = "ggraph",
  title = NULL
)

Arguments

predictors

A character vector of predictor variable names.

weights

A numeric vector of regression coefficients (weights).

outcome

A character string specifying the outcome variable.

method

A character string specifying the visualization method: either "ggraph" (modern graph), "sankey", or "alluvial".

title

An optional character string specifying a custom plot title. Defaults to a method-specific title.

Value

A graphical representation of the regression model.

Examples

predictors <- c("Age", "BMI", "Exercise", "Smoking")
weights <- c(0.5, -0.3, 0.7, -0.6)
outcome <- "Heart Disease"
# plot_regression_graph(predictors, weights, outcome, method = "ggraph", title = "My Custom Graph")
# plot_regression_graph(predictors, weights, outcome, method = "sankey")
# plot_regression_graph(predictors, weights, outcome, method = "alluvial", title = "Custom Alluvial Plot")