## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(collapse=TRUE, comment="#>", fig.width=8, fig.height=4.6)
set.seed(20261009)

## ----effect-estimates, eval=requireNamespace("ggplot2", quietly=TRUE)---------
effects <- data.frame(
  estimand = factor(c("Direct association", "Gaze-path association",
                      "Pupil-path association"),
                    levels = rev(c("Direct association",
                                   "Gaze-path association",
                                   "Pupil-path association"))),
  value = c(.18, .12, -.03),
  lo = c(.04, .02, -.12),
  hi = c(.32, .23, .07)
)
ggplot2::ggplot(effects, ggplot2::aes(y = estimand, x = value)) +
  ggplot2::geom_vline(xintercept = 0, linetype = 2) +
  ggplot2::geom_segment(
    ggplot2::aes(x = lo, xend = hi, yend = estimand),
    linewidth = .8, colour = "#387C88"
  ) +
  ggplot2::geom_point(size = 2.5, colour = "#245B65") +
  ggplot2::labs(
    title = "Effect-size reporting retains the uncertainty interval",
    subtitle = "Illustrative numbers and intervals, not fitted estimates or posterior credible intervals",
    x = "Illustrative standardised association", y = NULL
  ) +
  ggplot2::theme_minimal(base_size = 12)

## ----bootstrap-distributions, eval=requireNamespace("ggplot2", quietly=TRUE)----
resampling <- data.frame(
  estimate = c(stats::rnorm(1800, .12, .045),
               stats::rnorm(1800, -.03, .052)),
  path = rep(c("Gaze pathway", "Pupil pathway"), each = 1800)
)
ggplot2::ggplot(
  resampling, ggplot2::aes(x = estimate, fill = path)
) +
  ggplot2::geom_density(alpha = .33, colour = NA) +
  ggplot2::geom_vline(xintercept = 0, linetype = 2) +
  ggplot2::facet_wrap(~path, ncol = 1, scales = "free_y") +
  ggplot2::scale_fill_manual(values = c(
    "Gaze pathway" = "#387C88", "Pupil pathway" = "#A987B4"
  )) +
  ggplot2::labs(
    title = "Illustrative resampling distributions",
    subtitle = "Synthetic independent draws for visualization; not model-fitted bootstraps",
    x = "Effect contrast (illustrative units)", y = "Density"
  ) +
  ggplot2::theme_minimal(base_size = 12) +
  ggplot2::theme(legend.position = "none")

## ----edge-audit, eval=requireNamespace("ggplot2", quietly=TRUE)---------------
edge_comparison <- data.frame(
  from = factor(c("Treatment", "Gaze", "Trust", "Treatment"),
                levels = c("Treatment", "Gaze", "Trust")),
  to = factor(c("Gaze", "Trust", "Decision", "Decision"),
              levels = c("Decision", "Trust", "Gaze")),
  status = c("Both", "Theory only", "Discovered only", "Both")
)
ggplot2::ggplot(
  edge_comparison, ggplot2::aes(x = from, y = to, fill = status)
) +
  ggplot2::geom_tile(colour = "white", linewidth = 1, width = .94, height = .94) +
  ggplot2::scale_fill_manual(values = c(
    "Both" = "#387C88",
    "Theory only" = "#E2AA64",
    "Discovered only" = "#9B75A5"
  )) +
  ggplot2::labs(
    title = "Theory-vs-proposed-edge adjacency comparison",
    subtitle = "Synthetic graph illustration; a discovered directed edge is not causal proof",
    x = "From", y = "To", fill = "Edge category"
  ) +
  ggplot2::theme_minimal(base_size = 12)

## ----confounding-contrast, eval=requireNamespace("ggplot2", quietly=TRUE)-----
stress <- data.frame(
  quantity = factor(
    c("Controlled mediator intervention", "Observational model-based shift"),
    levels = c("Controlled mediator intervention",
               "Observational model-based shift")
  ),
  effect = c(.84, 1.19)
)
ggplot2::ggplot(
  stress, ggplot2::aes(x = quantity, y = effect, fill = quantity)
) +
  ggplot2::geom_col(width = .55) +
  ggplot2::geom_text(
    ggplot2::aes(label = sprintf("%.2f", effect)),
    vjust = -0.4, size = 4
  ) +
  ggplot2::scale_fill_manual(values = c("#387C88", "#E2AA64")) +
  ggplot2::coord_cartesian(ylim = c(0, 1.35)) +
  ggplot2::labs(
    title = "Known-truth identification failure despite an exact regression fit",
    subtitle = "Deterministic synthetic counterexample; difference = 0.35",
    x = NULL, y = "Mediator-shift contrast"
  ) +
  ggplot2::theme_minimal(base_size = 12) +
  ggplot2::theme(legend.position = "none")

