# \donttest{
# Load the example dataset
rdm_minimal_example <- system.file("extdata", "rdm_minimal", package = "eam")
sim_output <- load_simulation_output(file.path(rdm_minimal_example, "simulation"))
obs_df <- read.csv(file.path(rdm_minimal_example, "observation", "observation_data.csv"))
# Define summary statistics pipeline
summary_pipe <- summarise_by(
.by = c("condition_idx"),
rt_mean = mean(rt)
)
# Calculate summary statistics for simulation and observation
sim_summary <- map_by_condition(
sim_output,
.progress = FALSE,
.parallel = FALSE,
function(cond_df) {
summary_pipe(cond_df)
}
)
obs_summary <- summary_pipe(obs_df)
# Build ABC input
abc_input <- build_abc_input(
simulation_output = sim_output,
simulation_summary = sim_summary,
target_summary = obs_summary,
param = c("V_beta_1", "V_beta_group")
)
# Perform ABC parameter estimation using rejection method
abc_rejection_model <- abc::abc(
target = abc_input$target,
param = abc_input$param,
sumstat = abc_input$sumstat,
tol = 0.5,
method = "rejection"
)
# }
Run the code above in your browser using DataLab