build_ambric_model()
Build the AMBRIC Bayesian state-space model.
Usage
build_ambric_model(
y_uk, y_annual, factors, macro, bridge_signal, region_q_on_q=None
)The exogenous mean for latent regional growth is:
mu_exog[t,r] = Lambda[r] @ F[t] + Gamma[r] @ X[t] + delta_r * s[t,r]
where s[t,r] is the quarterly bridge signal from XGBoost + MIDAS. delta_r has a hierarchical shrinkage prior centred at zero.
Parameters
y_uk: npt.NDArray[np.float64]-
UK quarterly growth rates, shape (T,).
y_annual: npt.NDArray[np.float64]-
Regional annual growth rates, shape (T, R).
factors: npt.NDArray[np.float64]-
Extracted factors, shape (T, K).
macro: npt.NDArray[np.float64]-
Macro UK series, shape (T, M).
bridge_signal: npt.NDArray[np.float64]-
Quarterly bridge signal, shape (T, R).
region_q_on_q: npt.NDArray[np.float64] | None = None-
Optional published quarterly regional growth rates, shape
(T, R)with NaN in unobserved cells. Values must be decimal growth rates (e.g.0.005for 0.5%). When supplied,y_regis built as a hybridpm.Deterministic: at every(t, r)with an observed value,y_reg[t, r]is hard-clamped to that value; at NaN cells,y_reg[t, r]equals the sampled latenty_reg_free[t, r]. The clamped values then propagate through the UK aggregation, annual aggregation, and AR(1) dynamics, informing unobserved neighbours rather than competing with them through a likelihood term. Defaults toNone(no clamp — backwards compatible).
Returns
pm.model.core.Model-
PyMC model object.