Skip to content

Getting started

gp3bayespy is designed around explicit analysis stages rather than a single opaque fitting call. This page gets you from installation to an inspectable model specification and shows where to go next.

Installation

Choose the smallest environment that matches your task.

python -m pip install gp3bayespy

Use this for contracts, readiness, simulation, preparation, backend-free diagnostics, reproducibility, and many analytic workflows.

python -m pip install "gp3bayespy[bayes,plots]"

Adds optional Bayesian backends and Matplotlib integration.

python -m pip install "gp3bayespy[all]"

Matches the broad development and documentation environment.

Verify the installation:

import gp3bayespy as gp

print(gp.__version__)

Expected release version:

0.5.0

The contract-first workflow

1Contract
2Audit
3Priors
4Specify
5Fit
6Diagnose
7Estimate

1. Declare the model contract

from gp3bayespy import create_model_contract

contract = create_model_contract(
    family="binary",
    outcome_col="selected",
    participant_col="participant_id",
    trial_col="trial_id",
    condition_col="condition",
)

The contract records the approved model family and neutral column mappings. It does not fit a model.

2. Audit readiness

from gp3bayespy import audit_model_readiness

audit = audit_model_readiness(data, contract)
print(audit.status)

Readiness checks are evidence about whether the declared workflow can proceed. They are not substantive adequacy claims.

3. Declare priors

from gp3bayespy import create_prior_specification

priors = create_prior_specification(
    contract,
    baseline=0.5,
)

4. Close the specification

from gp3bayespy import create_model_specification

specification = create_model_specification(
    contract,
    audit,
    priors,
)

print(specification.formula_text)

At this point the data mappings, readiness evidence, prior declaration, and model structure are inspectable before fitting.

Where to go next

  • Binary outcomes

    Continue through simulation, preparation, fitting, posterior diagnostics, PPC, prediction, sensitivity, and recovery.

    Binary end-to-end →

  • Positive durations

    Use the lognormal-duration workflow for strictly positive uncensored duration outcomes.

    Duration end-to-end →

  • Predictive evidence

    Work with scoring, calibration, ROC/PR, predictive uncertainty, PSIS-LOO, and model comparison.

    Predictive diagnostics →

  • Dynamic pupil responses

    Start with measurement context, preparation, temporal structure, and explicit pupil estimands.

    Dynamic pupillometry →

Check optional backends

The package can inspect optional backend availability without compiling a model:

import gp3bayespy as gp

print(gp.backend_capabilities())

For installation and portability details, see Backend Portability and Installation.

Run the examples

The repository ships eight executable workflow scripts. Browse them on the Executable examples page or clone the repository and run:

python examples/binary_workflow.py
python examples/predictive_diagnostics.py
python examples/pupil_workflow.py

Interpretation boundaries

Warning

Passing readiness checks, fitting a model, or obtaining favourable diagnostics does not automatically establish convergence, adequacy, robustness, causal identification, preferred-model status, exclusion decisions, or psychological interpretation.

See Governance for the package-wide boundaries.