PROJECT SENTRY
PROJECT SENTRY / DOCS / 01_architecture_and_methodology.md

Project SENTRY: Architecture and Econometric Methodology

1. Sub-National Administrative Hierarchy

Project SENTRY formulates sub-national macroeconomic nowcasting as a hierarchical estimation problem across three nested administrative tiers in the Republic of the Philippines:

Level 0: National Macroeconomy

Philippines Real GDP / Quarterly National Accounts (QNA):

YPH,t=r=118Yr,tY_{\text{PH}, t} = \sum_{r=1}^{18} Y_{r, t}
Spatial Contiguity & Economic Gravity Coupling (WCFS)\Big\downarrow \text{\small Spatial Contiguity \& Economic Gravity Coupling } (W_{\text{CFS}})

Level 1: Regional Administrative Tier

18 Administrative Regions (NCR, CAR, Regions I–XIII, BARMM, NIR)
Gross Regional Domestic Product (GRDP) Panel: Yr,tY_{r, t}

Constrained Lagrangian Indicator-Assisted Denton Disaggregation\Big\downarrow \text{\small Constrained Lagrangian Indicator-Assisted Denton Disaggregation}

Level 2: Sub-Regional Provincial Tier

135 Provincial Product Accounts (PPA) Jurisdictions: Provinces & Highly Urbanized Cities (HUCs):

pRrPPA^p,t=GRDP^r,tr{1,,18}\sum_{p \in R_r} \widehat{\text{PPA}}_{p, t} = \widehat{\text{GRDP}}_{r, t} \quad \forall r \in \{1, \dots, 18\}

Hierarchy Invariants & Conservation Laws

  1. Regional Growth Balance (Stone's Linear Balance):
    r=118ωr,t1g~r,t=gPH,t,where ωr,t1=Yr,t1YPH,t1\sum_{r=1}^{18} \omega_{r, t-1} \cdot \tilde{g}_{r, t} = g_{\text{PH}, t}, \quad \text{where } \omega_{r, t-1} = \frac{Y_{r, t-1}}{Y_{\text{PH}, t-1}}
  2. Provincial Additivity (Denton Proportional Conservation):
    pRrPPA^p,t=GRDP^r,twith precision ϵ106\sum_{p \in R_r} \widehat{\text{PPA}}_{p, t} = \widehat{\text{GRDP}}_{r, t} \quad \text{with precision } \epsilon \le 10^{-6}
    3. Spatial Equilibrium Stability:

    maxeig(ρW)<1.0,j=118Wij=1.0i\max \big| \text{eig}(\rho W) \big| < 1.0, \quad \sum_{j=1}^{18} W_{ij} = 1.0 \quad \forall i

    2. Spatial Weight Matrix Formulations

    Pure NumPy Contiguity & Haversine 3-NN Maritime Augmentation

    Unlike continental economies, the Philippine archipelago comprises over 7,641 islands. Standard Queen contiguity leaves island regions (MIMAROPA, Central Visayas, Eastern Visayas, BARMM) completely isolated (Ai,=0A_{i, \cdot} = 0).

    To eliminate reliance on external geospatial C-libraries (gdal, geopandas, fiona, shapely), SENTRY implements pure NumPy analytical topology:

    1. Analytic Queen Contiguity (AQueenA_{\text{Queen}}): Direct land borders derived from official PSA/NAMRIA administrative geography.
    2. Haversine Great-Circle Distance:
      d(i,j)=2Rarcsin(sin2(Δϕ2)+cos(ϕi)cos(ϕj)sin2(Δλ2))d(i, j) = 2 R \arcsin \left( \sqrt{ \sin^2\left(\frac{\Delta \phi}{2}\right) + \cos(\phi_i)\cos(\phi_j)\sin^2\left(\frac{\Delta \lambda}{2}\right) } \right)
      where R=6,371.0 kmR = 6,371.0 \text{ km}, ϕ\phi is latitude, and λ\lambda is longitude of regional administrative centroids. 3. Directed kk-NN Augmentation (k=3k=3): For any region with fewer than k=3k=3 land neighbors, the kdeg(i)k - \deg(i) closest centroids are connected to model primary inter-island Ro-Ro (roll-on/roll-off) and maritime shipping channels.

      Economic Gravity Flow Matrix (WCFSW_{\text{CFS}})

      Physical distance alone fails to capture commercial dominance. The Philippine Statistics Authority (PSA) Commodity Flow in the Philippines (CFS) measures domestic trade flows across air, water, and rail transport:

      1. Bilateral Flow Aggregation: Tij=mValueijmT_{ij} = \sum_m \text{Value}_{ij}^m (annual trade value in PHP millions from origin ii to destination jj).
      2. Zero Diagonal: Tii=0T_{ii} = 0 (self-flows excluded).
      3. Row Normalization:
        WCFS,ij=Tijk=118TikW_{\text{CFS}, ij} = \frac{T_{ij}}{\sum_{k=1}^{18} T_{ik}}
      4. Convex Hybrid Formulation:
        W(α)=αWCFS+(1α)Wgeo,α[0,1]W(\alpha) = \alpha W_{\text{CFS}} + (1 - \alpha) W_{\text{geo}}, \quad \alpha \in [0, 1]
        Optimal α=0.65\alpha^* = 0.65 was identified via grid search maximizing the 2SLS spatial autoregressive concentrated log-likelihood:
        lnLc(α)=n2(1+ln(2π))n2ln(SSR(α)n)+lnIρW(α)\ln L_c(\alpha) = -\frac{n}{2} \big(1 + \ln(2\pi)\big) - \frac{n}{2} \ln \left(\frac{\text{SSR}(\alpha)}{n}\right) + \ln \big| I - \rho W(\alpha) \big|


        3. Spatial Dynamic Factor Model (SDFM)

        Conventional nowcasting separates factor extraction from spatial econometric adjustment. SENTRY's unified SDFM incorporates spatial feedbacks directly into the Kalman state-space observation operator.

        State-Space Representation

        1. Latent Factor State Equation (VAR(1)\text{VAR}(1)):
          ft=Aft1+ut,utN(0,Q)f_t = A f_{t-1} + u_t, \quad u_t \sim \mathcal{N}(0, Q)
          where ftRkf_t \in \mathbb{R}^k (k=3k=3 latent common factors), ARk×kA \in \mathbb{R}^{k \times k} satisfies stationary eigenvalues (maxeig(A)<0.95\max |\text{eig}(A)| < 0.95), and QRk×kQ \in \mathbb{R}^{k \times k} is positive semi-definite.
        2. Spatial Observation Operator: The structural regional equation across all 18 regions is:
          (IρW)yt=Λft+et,etN(0,Σe)(I - \rho W) y_t = \Lambda f_t + e_t, \quad e_t \sim \mathcal{N}(0, \Sigma_e)
          Inverting the spatial multiplier S(ρ)=(IρW)1S(\rho) = (I - \rho W)^{-1}:
          yt=Z(ρ)ft+vt,vtN(0,R(ρ))y_t = Z(\rho) f_t + v_t, \quad v_t \sim \mathcal{N}(0, R(\rho))
          where:
          Z(ρ)=(IρW)1Λ,R(ρ)=(IρW)1Σe(IρW)TZ(\rho) = (I - \rho W)^{-1} \Lambda, \quad R(\rho) = (I - \rho W)^{-1} \Sigma_e (I - \rho W)^{-T}

        Information Transmission Mechanism

        When an indicator release for Region jj arrives at time tt (e.g., Cebu port traffic or NCR wholesale index), the Kalman measurement update:

        ftt=ftt1+Kt(ytZtftt1)f_{t|t} = f_{t|t-1} + K_t \big(y_{t}^* - Z_t^* f_{t|t-1}\big)
        instantaneously propagates spatial spillovers to all other regions iji \ne j via Z(ρ)Z(\rho), ensuring continuous real-time cross-regional learning.

        4. Finite-Sample Conformal Interval Recalibration

        Because (IρW)1(I - \rho W)^{-1} concentrates observation errors, theoretical Kalman innovation covariance Ft=ZPtt1ZT+RF_t = Z P_{t|t-1} Z^T + R systematically underestimates empirical predictive uncertainty.

        To restore valid coverage without altering point nowcasts:

        1. Non-conformity scores are computed over out-of-sample walk-forward validation:
          αt=yr,ty^r,tσ^r,t\alpha_t = \frac{|y_{r, t} - \hat{y}_{r, t}|}{\hat{\sigma}_{r, t}}
        2. The calibrated conformal quantile q1βq_{1-\beta} for β=0.04\beta = 0.04 (96%96% nominal) is derived empirically:
          q0.96=6.32q_{0.96} = 6.32
        3. Conformalized 95%95% prediction intervals are constructed as:
          PI95(yr,t)=[y^r,tq0.96σ^r,t,  y^r,t+q0.96σ^r,t]\text{PI}_{95}(y_{r, t}) = \left[ \hat{y}_{r, t} - q_{0.96} \cdot \hat{\sigma}_{r, t}, \; \hat{y}_{r, t} + q_{0.96} \cdot \hat{\sigma}_{r, t} \right]
          This restores empirical coverage from 59.72%59.72\% to **95.83%95.83\%** while preserving point nowcast optimality (0.0251 pp MAE0.0251 \text{ pp MAE}).

        5. Domain-Partitioned Feature Gating

        Empirical analysis in Phase 9 revealed that pooling climate shock indicators (CHIRPS Standardized Precipitation Index and Cyclone Disturbance Index) globally across all 18 regions diluted tree split gains in manufacturing hubs (NCR, CALABARZON).

        SENTRY enforces Domain-Partitioned Feature Gating:

        • Metro / Industrial Hub Profile: Gating excludes raw precipitation and cyclone tracks, allocating capacity to foreign direct investment, US/China industrial production (INDPRO), remittance flows, and port transit volumes.
        • Agricultural / Island Profile: Retains high-dimensional climate proxies (CHIRPS precipitation anomalies, typhoon wind track intensity, Sentinel-2 NDVI vegetative vigor) to capture crop-cycle disruptions.

        6. Quad-Model 3-Tier Simplex Meta-Ensemble

        SENTRY combines four mathematically orthogonal model architectures:

        1. LightGBM: Non-linear gradient boosted regression trees with asymmetric directional penalty (λ=2.5\lambda = 2.5).
        2. Regularized ElasticNet: Sparse linear model with expanding-window cross-validation (1=0.5\ell_1 = 0.5).
        3. Unified Spatial DFM (SDFM): State-space dynamic factor model with endogenous spatial multiplier.
        4. Ridge U-MIDAS: Unrestricted mixed-frequency distributed lag regression bridging monthly indicators to annual output.

        3-Tier Simplex Stacking

        Weights w=(wLGBM,wEN,wSDFM,wMIDAS)Tw = (w_{\text{LGBM}}, w_{\text{EN}}, w_{\text{SDFM}}, w_{\text{MIDAS}})^T are solved via constrained quadratic optimization on expanding-window out-of-sample errors:

        minwt(ytm=14wmy^m,t)2s.t.m=14wm=1,wm0\min_{w} \sum_{t} \left( y_t - \sum_{m=1}^4 w_m \hat{y}_{m, t} \right)^2 \quad \text{s.t.} \quad \sum_{m=1}^4 w_m = 1, \quad w_m \ge 0
        Estimated independently across three economic archetypes: - **Tier 1 (National Capital Region):** High spatial and linear weights; low tree variance. - **Tier 2 (Industrial Regional Hubs):** Balanced spatial and gradient boosted tree weights. - **Tier 3 (Agricultural / Island Regions):** Balanced spatial, tree, and mixed-frequency autoregressive weights.

        7. Constrained Lagrangian Indicator-Assisted Denton Downscaling

        To disaggregate annual regional GRDP nowcasts GRDP^r,t\widehat{\text{GRDP}}_{r, t} into 135 provincial and HUC entities, SENTRY implements dynamic indicator-assisted Denton disaggregation.

        Let pr,p,tp_{r, p, t} denote the unknown provincial output level, pr,p,t1p_{r, p, t-1} the historical PPA baseline level, and zr,p,t>0z_{r, p, t} > 0 a high-frequency composite proxy constructed from:

        zr,p,t=0.45NTLp,t+0.35BankDepositsp,t+0.20VehicleRegp,tz_{r, p, t} = 0.45 \cdot \text{NTL}_{p, t} + 0.35 \cdot \text{BankDeposits}_{p, t} + 0.20 \cdot \text{VehicleReg}_{p, t}

        The objective minimizes relative distortions from the dynamic indicator while satisfying regional conservation:

        minpr,p,tp=1Kr(pr,p,tzr,p,tpr,p,t1zr,p,t1)2s.t.p=1Krpr,p,t=GRDP^r,t\min_{p_{r, p, t}} \sum_{p=1}^{K_r} \left( \frac{p_{r, p, t}}{z_{r, p, t}} - \frac{p_{r, p, t-1}}{z_{r, p, t-1}} \right)^2 \quad \text{s.t.} \quad \sum_{p=1}^{K_r} p_{r, p, t} = \widehat{\text{GRDP}}_{r, t}

        Closed-Form Solution

        Using Lagrangian multipliers, the exact solution is evaluated in O(Kr)\mathcal{O}(K_r) without iterative numerical solvers:

        pr,p,t=pr,p,t1(zr,p,tzˉr)+zr,p,t2kzr,k,t2(GRDP^r,tkpr,k,t1zr,k,tzˉr)p_{r, p, t}^* = p_{r, p, t-1} \left( \frac{z_{r, p, t}}{\bar{z}_r} \right) + \frac{z_{r, p, t}^2}{\sum_{k} z_{r, k, t}^2} \left( \widehat{\text{GRDP}}_{r, t} - \sum_{k} p_{r, k, t-1} \frac{z_{r, k, t}}{\bar{z}_r} \right)
        Non-negativity (pr,p,t0p_{r, p, t}^* \ge 0) is strictly enforced with proportional residual rescaling, guaranteeing zero conservation error.

        For the public-facing web workstation architecture, see Chapter 7: Web Frontend Architecture.

Mathematical typography rendered via KaTeX.
Research paper documentation compiled directly from /docs/.