Visualize O-information estimates for hyperedges identified during hypergraph construction. Each hyperedge is represented by its O-information value and, optionally, its bootstrap confidence interval.
Usage
plot_hyperedge(
hg,
significant_only = FALSE,
sort = TRUE,
show_ci = TRUE,
color_type = TRUE,
show_edge_label = TRUE,
point_size = 1.8,
redundant_color = "#0072B2",
synergistic_color = "#D55E00"
)Arguments
- hg
A
psychHypergraphobject produced bybuild_hypergraph.- significant_only
Logical; if
TRUE, only hyperedges passing the significance testing pipeline are displayed.- sort
Logical; if
TRUE, hyperedges are sorted by O-information values from largest to smallest.- show_ci
Logical; if
TRUE, bootstrap confidence intervals are displayed as horizontal error bars.- color_type
Logical; if
TRUE, points are colored according to hyperedge type:Redundant (positive O-information)
Synergistic (negative O-information)
- show_edge_label
Logical; if
TRUE, hyperedge labels are displayed on the y-axis.- point_size
Numeric value controlling point size.
- redundant_color
Color for redundant hyperedges (positive O-information).
- synergistic_color
Color for synergistic hyperedges (negative O-information).
Value
A ggplot2 object.
The returned object can be further customized using standard ggplot2 syntax.
Details
Positive O-information indicates redundant higher-order interactions, whereas negative O-information indicates synergistic interactions.
The resulting figure resembles a forest plot, allowing users to inspect the magnitude, direction, and uncertainty of hyperedge-level O-information estimates.
Hyperedges are plotted on the y-axis and O-information values on the x-axis. A vertical dashed line at zero separates redundant (\(O > 0\)) and synergistic (\(O < 0\)) interactions.
When bootstrap confidence intervals are available, they are displayed using the BCa intervals stored in the psychHypergraph object.
Hyperedge labels correspond to the variable indices defining each hyperedge. For example:
1-3-5represents the hyperedge formed by variables 1, 3, and 5.
For large hypergraphs, displaying all hyperedges may result in crowded
figures. In such cases, setting significant_only = TRUE or
subsetting the hypergraph beforehand is recommended.
Examples
if (FALSE) { # \dontrun{
library(psych)
data(bfi)
hg <- build_hypergraph(
data = bfi[,1:25],
k = 3:5,
candidate_method = "all",
cor_method = "pearson",
parallel = TRUE
)
# Plot all hyperedges
plot_hyperedge(hg)
} # }