Executable examples¶
Thirteen small scripts exercise the main workflow families. They are intentionally compact enough to read in one sitting and concrete enough to run as smoke tests.
Multilevel gaze mediation contract
Simulate repeated trials, prepare within/between components, specify the Bayesian model, and inspect estimable paths without requiring a sampler run.
python examples/multilevel_gaze_mediation_contract.py
View source →
Mediation failure cases
Exercise missingness, non-estimable paths, unsupported random slopes, and family-support errors explicitly.
python examples/multilevel_gaze_mediation_failure_cases.py
View source →
Multilevel mediation prior sensitivity
Keep the mediation data/model contract fixed while declaring narrower, default, and wider coefficient-prior scales.
python examples/multilevel_gaze_mediation_prior_sensitivity_contract.py
View source →
Multilevel mediation family contracts
Validate lognormal, Gamma, beta, Bernoulli, Poisson, and negative-binomial mediator support without sampling.
python examples/multilevel_gaze_mediation_family_contracts.py
View source →
Simulation/recovery planning
Generate weak, moderate, and strong known-truth mediation scenarios and verify the same preparation/model contract before backend-enabled recovery studies.
python examples/multilevel_gaze_mediation_simulation_recovery_contract.py
View source →
Binary workflow
Simulation → preparation → specification → prior predictive checking.
python examples/binary_workflow.py
View source →
Duration workflow
Positive-duration simulation and lognormal workflow specification.
python examples/duration_workflow.py
View source →
Predictive diagnostics
Backend-free ROC, precision-recall, and calibration diagnostics.
python examples/predictive_diagnostics.py
View source →
PSIS-LOO comparison
Pointwise log-likelihood draws, Pareto-k diagnostics, and descriptive ELPD comparison.
python examples/loo_model_comparison.py
View source →
Sensitivity workflow
Declarative sensitivity planning with automatic model selection and exclusion disabled.
python examples/sensitivity_workflow.py
View source →
Analysis manifest
Capture deterministic fingerprints for data, contract, specification, and transformations.
python examples/reproducibility_workflow.py
View source →
Pupil workflow
Advanced simulation, governed analytic fitting, trajectory prediction, and temporal audit.
python examples/pupil_workflow.py
View source →
Backend status
Inspect optional backend capability and environment state without compilation.
python examples/backend_status.py
View source →
Run from a source checkout¶
PYTHONPATH=src python examples/predictive_diagnostics.py
After installation, ordinary python is sufficient because gp3bayespy is importable from the active environment.
Suggested order¶
multilevel_gaze_mediation_contract.pymultilevel_gaze_mediation_failure_cases.pymultilevel_gaze_mediation_prior_sensitivity_contract.pymultilevel_gaze_mediation_family_contracts.pymultilevel_gaze_mediation_simulation_recovery_contract.pybinary_workflow.pypredictive_diagnostics.pyloo_model_comparison.pysensitivity_workflow.pyreproducibility_workflow.pypupil_workflow.py
For a guided narrative rather than scripts, continue to the Article library.