Skip to content

Roadmap

pyLGM 0.6 is a bounded, correct-by-construction foundation. This page is the honest map of what's shipped, what's next, and what's deliberately deferred. For the precise semantics of each shipped feature, follow the links into the guide.

Shipped in 0.6

  • Likelihoods — Gaussian (exact engine), Poisson, Bernoulli, Binomial (counts n·p with a per-row trials column), NegativeBinomial (overdispersed counts), Gamma (positive-continuous), and Beta (proportions in (0,1)), all on the Laplace engine, with fixed or estimated dispersion φ. See likelihoods.
  • Effects — Fixed, IID, RW1/RW2, stationary AR1 (optionally replicated: one independent series per panel unit, sharing ρ and precision), the drifting Seasonal pattern, the MIDAS mixed-frequency smooth-lag effect and its restricted (parametric) MIDASParametric counterpart (exp-Almon / Beta lag kernels), and the Knorr-Held SpaceTime interaction (Types I–IV). See effects.
  • Effect modifiers — R-INLA expresses weights, copy, replicate and group as arguments of one f() call; pyLGM ships them as composable wrappers, so any indexed effect gains them without each effect reimplementing four validation paths. Weighted(effect, by) scales the design by a column (spatially-varying coefficients); Copy(name, index, scale) lets one latent field enter a predictor twice at different indices, optionally under an estimated scale; Replicated(effect, over) gives R independent copies sharing every hyperparameter (I_R ⊗ Q); and Grouped(effect, over, structure) gives G correlated copies tied by a between-group precision (Q_S ⊗ Q_E), with IIDStructure, AR1Structure, RW1Structure/RW2Structure and BesagStructure available for Q_S. The three that map onto Knorr-Held's interaction types reproduce SpaceTime I–IV, which is how the composition is checked. Each modifier still produces exactly one latent block, so inference is untouched. See effects, and research status for what is and is not verified.

  • Hybrid composition — a mixed-frequency MIDAS term, a spatial BYM2 term, and a temporal AR1 term sum through + into one latent field that fits and predicts, demonstrated end to end in examples/hybrid_nowcast.

  • Spatial (CAR) family — Besag (ICAR), ProperCAR (with ρ fixed or estimated), and BYM2 (with φ fixed or estimated), complete for the dense reference regime. Graphs may be weighted ({node: {neighbour: weight}}), so the same family models firm-ownership / interbank-exposure / supply-chain networks, not only geographic adjacency. Isolated regions (no neighbours) are handled gracefully as independent IID singletons in Besag/BYM2 (dense and augmented paths), and the augmented large-graph BYM2 supports multi-component (island) graphs. See spatial effects.
  • Hyperparameter estimation — type-II ML empirical Bayes and MAP-II with PC/Gaussian priors, with bounded hyperparameters. See empirical Bayes.
  • Posterior integration — INLA-style grid quadrature with gaussian, simplified-Laplace, and full-Laplace latent marginals, plus DIC/WAIC/CPO/PIT model-assessment criteria. See INLA integration.
  • Prediction — fit-row and out-of-sample result.predict(new_data). See prediction.
  • Data boundary — Pandas, or Spark / Databricks input. See Spark.
  • Declarative frontend — models expressible in YAML via pylgm.config.load_model, including the temporal ar1 (optionally group-wise) and seasonal effects, the spatial besag/proper_car/bym2 families with an inline or file graph (graph_file accepts an R-INLA .graph or a .json neighbour dict), the Knorr-Held spacetime interaction (types I–IV, indexed by a space+time pair), the directed sar and its time-varying dynamicspatialpanel (SDPD, indexed by a unit+time pair with per-period inline graphs or a graph_files mapping), and the mixed-frequency midas (smooth-lag) and midas_parametric (exp-Almon / Beta kernel) effects, indexed by their HF lag columns. Every effect is now reachable from YAML — no Python-only effects remain. See spatial effects and effects.
  • Sparse large-graph scaling (E-sparse) — network and space-time models whose latent dimension exceeds the dense reference regime now fit past the dense guard through a sparse constrained-Gaussian solver, delivering posterior mean, marginal likelihood, estimated hyperparameters, and point predictions (A+B), and the full posterior-uncertainty surface at network scale (C): selected-inverse marginal, predictive, and linear-combination variances with constrained corrections, predict, sparse Sørbye-Rue scaling, augmented BYM2, and diagonal INLA grid integration — no new dependency, deterministic. The augmented BYM2 also exposes its structured component u* as a separately reported latent: latent_marginals("region") returns the x-marginals and latent_marginals("region.structured") the u* marginals. See spatial effects.
  • Survival likelihoods — WeibullSurv (Weibull proportional hazards, shape alpha fixed or estimated) and ExponentialSurv (alpha = 1), with right-censoring (event) and left-truncation (entry) support, alpha estimation by empirical Bayes, and unobserved heterogeneity via an ordinary IID frailty term over individuals. See likelihoods and the runnable unemployment-duration example.
  • Directed & dynamic network structure — a directed SAR effect ((I−ρW)ᵀ(I−ρW) on a row-standardized, generally-asymmetric W) for economic influence relations that symmetric CAR discards, and its time-varying generalization DynamicSpatialPanel (contemporaneous ρ, temporal γ, spatio-temporal-diffusion η over a balanced unit x time grid, T=1 reducing exactly to SAR). Both fit past the dense guard through the E-sparse solver, support forward forecasting (forecast_dynamic_spatial_panel) for future periods' networks, and both are declarable from YAML (type: sar / type: dynamicspatialpanel). See spatial effects and examples/directed_network_sar.
  • Diagnostics — an empirical-Bayes estimate that lands on the edge of its declared interval is now reported in result.diagnostics["hyperparameters_at_bound"] and warned about, because a pinned estimate means the bound (often a default derived from initial) rather than the data is setting the value.

Joint models are research-grade and live on the research-tier branch, not main. They are tested and reviewed, but validated only internally and against MCMC on simulated data -- no published result on real data has been reproduced, and latent_strategy="laplace" is known to degrade on them. See research status for exactly what is and is not established.

  • Joint multi-likelihood models — Joint stacks several LGM sub-models (each with its own response, likelihood, offset, and predictor) into one fit, with Shared letting one latent field enter more than one sub-model under a per-sub-model scaling, including the Knorr-Held & Best (delta, delta⁻¹) shared-component pairing for exactly two sub-models. Fits by engine="laplace" only; per-outcome prediction via result.predict(new_data, outcome=...). This covers the scaling half of R-INLA's copy — a shared field entering another sub-model under an estimated multiplicative scale — but the copied field's own hyperparameters (precision, rho, phi, ...) must stay fixed, unlike copy, which estimates those too. It also does not cover off-block-diagonal precision coupling (coregionalization) — see joint models. copy and replicate within a single sub-model shipped separately, as the Copy and Replicated modifiers above.

Breaking changes in 0.6

  • forecast_dynamic_spatial_panel returns latent_mean / latent_variance instead of mean / variance. The values are unchanged; the old names read as a response-scale forecast, but they exclude the fixed effects, so comparing them with observations was wrong by the response's mean level. See spatial effects.

Next

Ordered roughly by expected value to users. Nothing here is committed to a date.

  1. Matérn / SPDE spatial fields as an alternative to CAR neighbour graphs.
  2. Hybrid HF/LF nowcasting frontend — a higher-level mixed-frequency nowcasting API that handles the HF→LF lag alignment (still the caller's job today). The underlying effects ship both in the Python API and as the declarative midas / midas_parametric YAML types.

Deferred (not planned for the near term)

  • Parameterized IR metadata and sparse production engines.
  • Full MCMC/HMC inference — pyLGM is deterministic-approximation-first by design.

How to influence this

Open an issue at github.com/Ardea00/pylgm/issues describing the model you're trying to fit. Real use cases reorder this list.