## ----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) eval(formals(janusplot_shape_sensitivity)$shapes) ## ----demo-data---------------------------------------------------------------- data("shape_sensitivity_demo") str(shape_sensitivity_demo, vec.len = 2) ## ----recovery-curves, fig.cap = "Archetype-recovery accuracy against noise level (sigma) for each of the six ground-truth shapes, at each of the three sample sizes.", fig.alt = "Line plot of archetype-recovery accuracy versus sigma, one line per shape, faceted or coloured by sample size; five lines stay high across the noise range and one (linear_up) sits near 0.7 throughout."---- plot(shape_sensitivity_demo, "recovery_curves") ## ----archetype-confusion, fig.width = 6, fig.height = 5, fig.cap = "Confusion matrix of true archetype (rows) against predicted archetype (columns), pooled across all n, sigma and replicates in the demo.", fig.alt = "Archetype confusion matrix with true archetypes on the rows and predicted archetypes on the columns; nearly all mass sits on the diagonal, and linear_up truth splits between monotone_linear and monotone_curved."---- plot(shape_sensitivity_demo, "confusion_archetype") ## ----accuracy-grid, fig.cap = "Heatmap of archetype-recovery accuracy across the full (n, sigma) design, one panel per shape.", fig.alt = "Grid of heatmap panels, one per ground-truth shape, with sample size on one axis and noise level on the other, cells shaded by archetype-recovery accuracy; five panels are dark (high accuracy) with lighter cells at the highest noise level, and the linear_up panel is uniformly mid-toned."---- plot(shape_sensitivity_demo, "accuracy_grid") ## ----summary------------------------------------------------------------------ head(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") # 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("linear_up", "concave_up", "convex_up"), # n_grid = c(200L, 500L), # sigma_grid = c(0.05, 0.10, 0.20), # n_rep = 100L, # cutoffs = strict # ) # # summary(res_strict, level = "fine") ## ----session-info------------------------------------------------------------- sessionInfo() .