## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse  = TRUE,
  comment   = "#>",
  fig.align = "center",
  fig.width = 8,
  fig.height = 6,
  dpi       = 110
)

## ----setup-pkg----------------------------------------------------------------
library(janusplot)
library(ggplot2)

janusplot_shape_sensitivity_shapes()

## ----demo-data----------------------------------------------------------------
data("shape_sensitivity_demo")
str(shape_sensitivity_demo, vec.len = 2)

## ----recovery-curves----------------------------------------------------------
janusplot_shape_sensitivity_plot(shape_sensitivity_demo,
                                 "recovery_curves")

## ----archetype-confusion, fig.width = 6, fig.height = 5-----------------------
janusplot_shape_sensitivity_plot(shape_sensitivity_demo,
                                 "confusion_archetype")

## ----accuracy-grid------------------------------------------------------------
janusplot_shape_sensitivity_plot(shape_sensitivity_demo,
                                 "accuracy_grid")

## ----summary------------------------------------------------------------------
head(janusplot_shape_sensitivity_summary(shape_sensitivity_demo,
                                         level = "archetype"), 10)

## ----full-sweep, eval = FALSE-------------------------------------------------
# # Configure parallel execution (optional) — you control the plan.
# future::plan(future::multisession, workers = 4L)
# 
# res <- janusplot_shape_sensitivity(parallel = TRUE)
# 
# # Save for your paper
# saveRDS(res, "shape_sensitivity_full.rds")
# janusplot_shape_sensitivity_plot(res, "recovery_curves")

## ----custom-subset, eval = FALSE----------------------------------------------
# strict <- janusplot_shape_cutoffs(mono_strong = 0.95, curv_low = 0.1)
# 
# res_strict <- janusplot_shape_sensitivity(
#   shapes     = c("wave", "bimodal", "bi_wave"),
#   n_grid     = c(200L, 500L),
#   sigma_grid = c(0.05, 0.10, 0.20),
#   n_rep      = 100L,
#   cutoffs    = strict
# )
# 
# janusplot_shape_sensitivity_summary(res_strict, level = "fine")

## ----session-info-------------------------------------------------------------
sessionInfo()

