Creates a network-style graph showing how a set of predictors (`x_vars`) are related to an outcome (`y_var`). Relationships can be displayed either as conditional probabilities or as effects estimated by logistic regression.
plot_prob(
data,
y_var,
x_vars,
var_labels = NULL,
prob_digits = 2,
method = "conditional",
title = NULL,
vertex_color = "lightblue",
vertex_frame_color = "darkblue",
vertex_label_color = "black",
edge_color = "darkgrey",
edge_label_color = "black",
min_arrow_width = 1,
max_arrow_width = 10,
node_size = 45,
label_cex = 0.8
)A graph object (typically an [`igraph::igraph`] object or similar) is returned and plotted. Nodes represent variables and edges represent associations. Node labels include variable names and marginal probabilities. Edge labels display either conditional probabilities or logistic regression effects.
A data frame containing the outcome (`y_var`) and predictors (`x_vars`).
Character string giving the name of the outcome variable in `data`.
Character vector of predictor variable names in `data`.
Optional character vector of display labels for the predictors. Must match the length of `x_vars`.
Integer; number of decimal places to round conditional probabilities. Defaults to `2`.
Character string indicating how to quantify associations: `"prob"` for conditional probabilities or `"logistic"` for logistic regression effects.
Character string; title of the plot.
Character string giving the fill color of nodes.
Character string giving the color of node borders.
Character string giving the color of node labels.
Character string giving the color of edges.
Character string giving the color of edge labels.
Numeric value for the minimum edge width.
Numeric value for the maximum edge width.
Numeric value controlling the size of nodes.
Numeric value controlling the size of node labels.
plot_prob(misimdata,'y',colnames(misimdata[,3:6]),method='logistic')
Run the code above in your browser using DataLab