Learn R Programming

eam (version 1.1.0)

abc_postpr: ABC model comparison wrapper

Description

Wrapper function for postpr to facilitate model comparison. This function simplifies the process of comparing multiple models using ABC by automatically stacking summary statistics and creating model indices.

Usage

abc_postpr(sumstats = list(), target, ...)

Value

An object of class "postpr" from postpr

Arguments

sumstats

A named list of summary statistics matrices from different models. Each element should be a matrix or data frame with the same columns.

target

Target summary statistics from observed data (vector or matrix)

...

Additional arguments passed to postpr

Examples

Run this code
# Load pre-computed ABC input for model comparison
# This example compares the same model to itself for demonstration
rdm_minimal_example <- system.file("extdata", "rdm_minimal", package = "eam")
abc_input <- readRDS(file.path(rdm_minimal_example, "abc", "abc_input.rds"))

# Compare two models using their summary statistics
# In practice, create different abc_input objects for different models:
# abc_input_1 <- build_abc_input(..., simulation_summary = sim_summary_1, ...)
# abc_input_2 <- build_abc_input(..., simulation_summary = sim_summary_2, ...)
postpr_result <- abc_postpr(
  sumstats = list(model1 = abc_input$sumstat, model2 = abc_input$sumstat),
  target = abc_input$target,
  tol = 0.5,
  method = "rejection"
)

# View model comparison results
summary(postpr_result)

Run the code above in your browser using DataLab