Skip to content

Add 40 complex PyMC model implementations#320

Open
twiecki wants to merge 1 commit intostan-dev:masterfrom
twiecki:pymc-complex
Open

Add 40 complex PyMC model implementations#320
twiecki wants to merge 1 commit intostan-dev:masterfrom
twiecki:pymc-complex

Conversation

@twiecki
Copy link
Copy Markdown

@twiecki twiecki commented Mar 15, 2026

Summary

Companion PR to #319. Adds PyMC translations for the remaining 40 Stan models that use advanced modeling features.

What makes these "complex"

  • pm.Potential for Jacobian corrections and custom log-probability terms
  • Helper functions for simplex transforms (ILR/Helmert), ODE solvers, GP spectral densities, HMM forward algorithms
  • pytensor.scan for time series (GARCH, ARMA, state-space)

Models included

  • IRT: 2pl_latent_reg_irt, grsm_latent_reg_irt, hier_2pl
  • Capture-recapture: M0, Mb, Mh, Mt, Mtbh, Mth
  • HMMs: hmm_drive_0, hmm_drive_1, hmm_example
  • Topic models: ldaK2, ldaK5 (with ILR simplex transform)
  • GPs: accel_gp, hierarchical_gp
  • Time series: arma11, garch11, state_space_stochastic_level_stochastic_seasonal
  • ODEs: lotka_volterra, one_comp_mm_elim_abs
  • Forecasting: prophet
  • Other: bones_model, bym2_offset_only, losscurve_sislob, multi_occupancy, nes, surgical_model, Survey_model, GLM_Binomial_model, and radon/logmesquite/Rate variants

Data wrangling

All numpy data wrangling occurs before with pm.Model(), per reviewer feedback on #319.

Test plan

  • All 40 models pass gradient validation against BridgeStan (rtol=1e-5, atol=1e-6)
  • All numpy operations moved before with pm.Model()
  • Updated .info.json files to register PyMC implementations

Add PyMC translations for 40 Stan models that use advanced features:
Potentials for Jacobian corrections, custom helper functions (simplex
transforms, ODE solvers, GP spectral densities, HMM forward algorithms),
and scan-based time series models.

Includes: IRT models, capture-recapture (M0-Mth), HMMs, LDA topic
models, GP models, GARCH, ARMA, prophet, Lotka-Volterra ODE,
state-space models, and hierarchical GP with simplex parameters.

All numpy data wrangling occurs before the pm.Model context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants