generate_CEG_map {stCEG} | R Documentation |
Generate a Leaflet Map for a Chain Event Graph (CEG)
Description
This function generates an interactive map using the Leaflet package to visualize the probability of each area in the Chain Event Graph (CEG). The map is color-coded based on area-specific probabilities, which are calculated from the path products and conditional probabilities.
Usage
generate_CEG_map(
shapefile,
ceg_object,
conditionals = unique(ceg_object$x$edges$label1),
colour_by = NULL,
color_palette = "viridis"
)
Arguments
shapefile |
A Simple Features (sf) object representing the shapefile data for the geographical areas. |
ceg_object |
A list containing the Chain Event Graph (CEG) data, including nodes and edges. |
conditionals |
A character vector containing the conditions (labels) to condition on when calculating
area probabilities. Default is the unique edge labels from the |
colour_by |
A string specifying the label by which to color the map. Default is |
color_palette |
A string specifying the color palette to use for the map. Default is "viridis". |
Value
A Leaflet map object with color-coded polygons representing the areas, with a legend indicating the probability values for each area.
Examples
data <- homicides
event_tree <- create_event_tree(data, columns = c(9,2,4,5), "both")
coloured_tree <- ahc_colouring(event_tree)
tree_priors <- specify_priors(coloured_tree, prior_type = "Uniform", ask_edit = FALSE)
staged_tree <- staged_tree_prior(coloured_tree, tree_priors)
ceg <- create_ceg(staged_tree, view_table = TRUE)
generate_CEG_map(bcu_shapefile, ceg)