Learn R Programming

stCEG (version 0.1.0)

summary.chain_event_graph: Summarise a Chain Event Graph Model

Description

Computes the total log marginal likelihood, effective sample size (ESS), and per-stage log scores for a fitted Chain Event Graph (CEG) model using conjugate prior/posterior updates.

Usage

# S3 method for chain_event_graph
summary(object, ...)

Value

An invisible object of class summary.chain_event_graph, which is a list containing:

total_log_marginal_likelihood

Total log marginal likelihood across all stages.

per_stage_log_scores

A data frame with log scores and effective sample sizes (ESS) for each stage.

Arguments

object

An object of class chain_event_graph, which must contain an update_table with prior and data columns for each stage.

...

Additional arguments (currently unused).

Details

The log marginal likelihood is computed using the Dirichlet-multinomial formula.

The effective sample size for a stage is defined as \(ESS = \sum_j (\alpha_{ij} + y_{ij})\). It represents the amount of information (prior + observed) available for that stage.

Examples

Run this code
data <- homicides
event_tree <- create_event_tree(data, columns = c(1,2,4,5), "both")
coloured_tree <- ahc_colouring(event_tree)

# Cannot run this whole chunk at once as specify_priors needs user input
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)
homicides_CEG_summary <- summary(ceg)

Run the code above in your browser using DataLab