Data Schemas¶
Pydantic data contracts for all inference results, configurations, and diagnostics.
data_schemas
¶
Pydantic data contracts for Bayesian A/B test resources.
Defines request / response schemas for the non-paired Beta-Bernoulli model, the paired Laplace model, and the paired Pólya-Gamma Gibbs model.
CredibleInterval
¶
Bases: BaseModel
Symmetric credible (or confidence) interval.
BetaParams
¶
Bases: BaseModel
Parameters of a Beta distribution.
SavageDickeyResult
¶
Bases: BaseModel
Result of a Savage-Dickey density-ratio Bayes factor test.
PosteriorProbH0Result
¶
Bases: BaseModel
Posterior probability of H0 under a spike-and-slab prior.
PPCStatistic
¶
Bases: BaseModel
Single posterior predictive check statistic.
NonPairedTrueParams
¶
Bases: BaseModel
True parameters used to generate non-paired simulation data.
NonPairedSimResult
¶
Bases: BaseModel
Output of :func:simulate_nonpaired_scores.
PairedTrueParams
¶
Bases: BaseModel
True parameters used to generate paired simulation data.
PairedSimResult
¶
Bases: BaseModel
Output of :func:simulate_paired_scores.
NonPairedConfig
¶
Bases: BaseModel
Configuration for :class:NonPairedBayesPropTest.
NonPairedTestResult
¶
Bases: BaseModel
Output of :meth:NonPairedBayesPropTest.test.
NonPairedSummary
¶
Bases: BaseModel
Summary produced by :meth:NonPairedBayesPropTest.fit.
PairedSummary
¶
Bases: BaseModel
Summary produced by :meth:PairedBayesPropTest.fit (Laplace or PG).
PairedLaplaceConfig
¶
Bases: BaseModel
Configuration for :class:PairedBayesPropTest (Laplace approximation).
PairedPGConfig
¶
Bases: BaseModel
Configuration for :class:PairedBayesPropTestPG (PG Gibbs sampler).
MCMCParamDiagnostic
¶
Bases: BaseModel
MCMC convergence diagnostics for a single parameter.
MCMCDiagnostics
¶
Bases: BaseModel
MCMC diagnostics for all parameters.
ROPEResult
¶
Bases: BaseModel
Result of a ROPE (Region of Practical Equivalence) analysis.
Decision rules (Kruschke, 2018):
- 95% CI entirely outside ROPE → Reject H₀
- 95% CI entirely inside ROPE → Accept H₀
- 95% CI overlaps ROPE → Undecided
from_samples(samples, rope=(-0.02, 0.02), ci_mass=0.95)
classmethod
¶
Compute ROPE decision from posterior samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samples
|
NDArray[floating]
|
1-D array of posterior draws for Δ (e.g. θ_A − θ_B). |
required |
rope
|
tuple[float, float]
|
(lower, upper) bounds of the ROPE. |
(-0.02, 0.02)
|
ci_mass
|
float
|
Credible interval mass (default 95%). |
0.95
|
Returns:
| Name | Type | Description |
|---|---|---|
Populated |
ROPEResult
|
class: |
Source code in bayesprop/resources/data_schemas.py
HypothesisDecision
¶
Bases: BaseModel
Composite hypothesis test result combining multiple decision frameworks.
Depending on the chosen :attr:rule, one or more of the sub-results
will be populated.
SequentialPosteriorState
¶
Bases: BaseModel
Running Beta posterior state for a sequential non-paired test.
By Beta-Bernoulli conjugacy this is the prior for the next batch.
SequentialLookResult
¶
Bases: BaseModel
Snapshot of the sequential test after a single look (batch update).
SequentialLaplaceState
¶
Bases: BaseModel
Running Laplace posterior state for the sequential paired model.
Carries the MAP estimate and 2x2 covariance of (mu, delta_A) on the logit scale, recomputed from cumulative sufficient statistics at every look.
SequentialLaplaceLookResult
¶
Bases: BaseModel
Snapshot of the sequential paired Laplace test after a single look.