## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
library(gp3bayes)

## ----eval=FALSE---------------------------------------------------------------
# fit_binary <- fit_binary_model_backend(
#   binary_specification,
#   backend = "cmdstanr"
# )
# 
# binary_estimand <- estimate_standardized_probability_contrast(
#   fit_binary,
#   target_data = target_population,
#   target_scale = "raw",
#   include_group_effects = FALSE
# )
# 
# summarise_estimand_draws(binary_estimand)
# plot(binary_estimand, quantity = "probability_difference")

## ----eval=FALSE---------------------------------------------------------------
# fit_duration <- fit_duration_model_backend(
#   duration_specification,
#   backend = "cmdstanr"
# )
# 
# duration_estimand <- estimate_standardized_duration_estimands(
#   fit_duration,
#   predictive_quantile = 0.90,
#   include_group_effects = FALSE,
#   seed = 2026
# )
# 
# summarise_estimand_draws(duration_estimand)
# plot(duration_estimand, quantity = "conditional_median_ratio")
# plot(duration_estimand, quantity = "predictive_quantile_difference")

## ----eval=FALSE---------------------------------------------------------------
# random_slope_plan <- create_random_slope_sensitivity_plan(
#   binary_specification
# )
# 
# random_slope_result <- run_random_slope_sensitivity(
#   random_slope_plan,
#   backend = "cmdstanr"
# )
# 
# random_slope_result$comparison

## ----eval=FALSE---------------------------------------------------------------
# participant_plan <- create_group_deletion_sensitivity_plan(
#   binary_specification,
#   group = "participant",
#   units = c("p001", "p002", "p003")
# )
# 
# participant_result <- run_group_deletion_sensitivity(
#   participant_plan,
#   backend = "cmdstanr"
# )

## ----eval=FALSE---------------------------------------------------------------
# contrast_spec <- create_contrast_coding_sensitivity_specification(
#   binary_specification,
#   condition_coding = c(0, 1),
#   baseline = 0.35
# )
# 
# scaling_spec <- create_predictor_scaling_sensitivity_specification(
#   binary_specification,
#   predictor = "trial_covariate",
#   scale_factor = 2,
#   coefficient_scale = 1.50,
#   interaction_scale = 0.50
# )
# 
# seconds_spec <- create_duration_unit_sensitivity_specification(
#   duration_specification,
#   multiplier = 0.001,
#   new_unit = "seconds"
# )

## ----eval=FALSE---------------------------------------------------------------
# kfold <- compute_kfold_cv(
#   fit_binary,
#   K = 5,
#   folds = "grouped",
#   group = "participant_id"
# )
# kfold

