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
)
A character vector of predictor variable names.
A numeric vector of regression coefficients (weights).
A character string specifying the outcome variable.
A character string specifying the visualization method: either "ggraph" (modern graph), "sankey", or "alluvial".
An optional character string specifying a custom plot title. Defaults to a method-specific title.
A graphical representation of the regression model.
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")