---
title: "Dataset Shift and Robustness Auditing"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Dataset Shift and Robustness Auditing}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
library(gp3ml)
```

Dataset shift is not one scalar drift score. gp3ml keeps predictor-distribution
shift, missingness shift, prevalence shift, calibration drift, and performance
degradation conceptually separate.

```{r}
development <- data.frame(
  fixation_duration = 180 + 1:30,
  condition = rep(c("A", "B"), 15)
)
external <- data.frame(
  fixation_duration = 205 + 1:30,
  condition = rep(c("A", "C"), 15)
)

shift <- audit_gazepoint_dataset_shift(
  development,
  external,
  predictors = c("fixation_duration", "condition")
)

missingness <- audit_gazepoint_missingness_shift(
  development,
  external,
  predictors = c("fixation_duration", "condition")
)

summarize_gazepoint_shift(shift, missingness)
plot(shift)
```

Robustness diagnostics should examine dependence on seeds, folds, features,
thresholds, missingness scenarios, and other declared analytical choices rather
than relabelling one successful analysis as robust.
