---
title: 'H-SGDLM: Heterogeneous Graphical Dynamic Linear Model'
url: https://www.emergentmind.com/topics/heterogeneous-simultaneous-graphical-dlm-h-sgdlm
type: topic
---

# H-SGDLM: Heterogeneous Graphical Dynamic Linear Model

The Heterogeneous Simultaneous Graphical Dynamic Linear Model (H-SGDLM) is a fully Bayesian, multivariate time series model which contemporaneously couples a universe of Dynamic Linear Models (DLMs) via a dynamic, sparsely parameterized precision matrix. H-SGDLM extends standard simultaneous graphical DLMs by incorporating heterogeneous autoregressive components, designed to capture both endogenous temporal dependencies (e.g., autoregressive signals) and exogenous cross-series influences (through a dynamically learned, sparse network structure). The approach supports efficient GPU-based inference and compositional variance decomposition, and underpins scalable procedures for high-dimensional, interpretable financial modeling, notably sparse mean-reverting portfolio construction via quasi-convex optimization and cyclical coordinate descent. 

## 1. State-Space Formulation and Model Specification

H-SGDLM observes an $n$-dimensional time series, typically log-prices $S_t = (s_{1,t}, \ldots, s_{n,t})^T$. For each asset $j = 1,\ldots,n$, the model posits a univariate DLM of the form
\[
s_{j,t} = F_{j,t}^\top \theta_{j,t} + v_{j,t}, \qquad \theta_{j,t} = G_{j,t} \theta_{j,t-1} + \omega_{j,t},
\]
with observation noise $v_{j,t} \sim N(0, \lambda_{j,t}^{-1})$ and state noise $\omega_{j,t} \sim N(0, W_{j,t})$.

The regressor vector $F_{j,t}$ is partitioned into:
- Endogenous terms $e_{j,t}$ (lags of returns, moving averages, leverage terms, and derived signals).
- Exogenous terms $r_{sp_t(j),t}$ given by the real-time values of assets in a dynamically selected parent set $sp_t(j)$.

The state vector $\theta_{j,t} = (\phi_{j,t}, \gamma_{j,t})$ encapsulates regression coefficients on endogenous ($\phi_{j,t}$) and exogenous ($\gamma_{j,t}$) predictors, with $(\lambda_{j,t}^{-1}, W_{j,t})$ conforming to conjugate Inverse Gamma prior structure.

To capture cross-asset dependencies, the DLMs are coupled via a sparse, time-varying exogenous coefficient matrix $\Gamma_t = [\gamma_{j,k,t}]_{j,k=1}^n$, forming a dynamic, non-symmetric graphical structure. The joint law at time $t$ is then
\[
S_t \sim N(H_t \mu_t,\, \Sigma_t), \quad H_t = (I - \Gamma_t)^{-1}, \quad \mu_t = \left[ F_{j,t}^\top m_{j,t-1} \right]_{j=1}^n,
\]
with implied precision and covariance
\[
\Omega_t = \Sigma_t^{-1} = (I-\Gamma_t)^T \Lambda_t (I-\Gamma_t), \qquad \Sigma_t = (I-\Gamma_t)^{-1} \Lambda_t^{-1} (I-\Gamma_t)^{-T},
\]
where $\Lambda_t = \text{diag}(\lambda_{1,t},\ldots,\lambda_{n,t})$.

## 2. Bayesian Filtering, Priors, and Sequential Inference

For each series $j$, H-SGDLM maintains Normal–Gamma conjugate priors:
\[
\theta_{j,t-1} \mid D_{t-1} \sim N(m_{j,t-1}, C_{j,t-1}), \quad \lambda_{j,t} \mid D_{t-1} \sim \Gamma(a_{j,t-1}, b_{j,t-1}).
\]
Forecast and filtering through Kalman-type recursions yield:
\[
a_{j,t}=G_{j,t}\,m_{j,t-1}, \qquad R_{j,t}=G_{j,t}C_{j,t-1}G_{j,t}^T+W_{j,t}
\]
\[
f_{j,t}=F_{j,t}^\top a_{j,t}, \qquad Q_{j,t}=F_{j,t}^\top R_{j,t}F_{j,t}+\lambda_{j,t}^{-1}
\]
\[
e_{j,t}=s_{j,t}-f_{j,t}, \quad A_{j,t}=R_{j,t}F_{j,t}/Q_{j,t}
\]
\[
m_{j,t}=a_{j,t}+A_{j,t}e_{j,t}, \quad C_{j,t}=R_{j,t}-A_{j,t}F_{j,t}^\top R_{j,t}
\]
\[
a_{j,t}=a_{j,t-1}+\tfrac12, \qquad b_{j,t}=b_{j,t-1}+\tfrac{e_{j,t}^2}{2Q_{j,t}}
\]
with all hyperparameter updates following standard Normal–Gamma algebra.

## 3. Sparse Graphical Structure and Parent Selection

The cross-sectional (graph) structure is built through data-driven selection and shrinkage:
- For each $j$, an empirical covariance or sparse Wishart filter identifies high-magnitude conditional dependencies, producing candidate parent sets $up_t(j)$.
- Candidate parents are dynamically promoted or demoted between core $sp_{core,t}(j)$ and down-set via their estimated signal-to-noise ratios.
- This yields a sparse adjacency matrix $\Gamma_t$ encoding current conditional relationships among assets, which is generally both directed and time-varying.
- Sparsity is induced by limiting parent-set sizes ($K \ll n$) and is dynamically adapted at each time step.

## 4. Computational Implementation and Scalability

The model is architected for efficient high-dimensional inference:
- All univariate DLM updates are independent conditional on parent-sets, enabling perfect parallelism—well-matched to GPU tensor operations.
- The only cross-series computation is the "recoupling" step, involving the assembly of $\Gamma_t$, $\Lambda_t$ and determinant evaluations, typically handled with $N_{MC}\sim$ few-hundred Monte Carlo samples.
- GPU implementations with TensorFlow and sparse-pattern storage for $\Gamma_t$ achieve real-time updates for dimensions $n\approx 500$, $K\approx 10$, $N_{MC}\sim 500$.
- Per-update complexity: parent selection $O(n^2)$ (with thresholding), individual DLM update $O(p^3)$ ($p\sim 10$), and inversion $(I - \Gamma_t)^{-1}$ at $O(n K^2)$ by exploiting sparsity.

## 5. Mean-Reverting Portfolio Construction

A primary application is the construction of sparse, mean-reverting portfolios:
- At time $t$, given H-SGDLM estimates $D_t$ (candidate predictive covariance, e.g., $\Sigma_t$) and empirical covariance $\tilde\Sigma_t$, the following quasi-convex optimization is solved:
\[
\min_{x\in\R^n} \ x^T(D_t-\tilde\Sigma_t)x + \beta\|x\|_2^2 \quad \text{s.t.} \ \|x\|_1 = 1, \quad \beta > 0,
\]
interpreted as the “predictability difference” $\operatorname{Var}(\hat P_t)-\operatorname{Var}(P_t)$ (Box), with sparsity arising from restricting $x$ to nonzero entries corresponding to a graph block of assets.
- The block is defined by the current H-SGDLM parent graph; further sparsity can be imposed by referencing nonzero entries in $\Omega_t$.

The optimization is efficiently solved via cyclical coordinate descent (CCD):
- For $M = D_t - \tilde\Sigma_t + \beta I$, the per-coordinate update for $x_i$ is:
\[
x_i = -\frac{\sum_{j\neq i} M_{ij} x_j}{M_{ii}}
\]
(normed after each sweep to enforce $\|x\|_1=1$).
- An $\ell_1$-penalty can be incorporated for further sparsification via soft-thresholding.
- CCD exhibits geometric convergence; the objective is differentiable and quasi-convex with convergence guarantee by Tseng (2001, Thm 5.1).

### CCD Pseudocode (as specified in [1905.05841])

```
Input: M ∈ R^{n×n} positive‐definite, tol>0
Initialize x^(0) with ||x^(0)||_1=1
r=0
repeat
  for i=1…n do
    a = ∑_{j≠i} M_{ij}·x_j^(r)
    x_i^(r+½) = −a/M_{ii}
  end
  x^(r+1) = x^(r+½)/||x^(r+½)||_1   # renormalize
  r = r+1
until ||x^(r)−x^(r−1)||_2 < tol
Output: x^*
```

## 6. Variance Decomposition and Interpretability

H-SGDLM enables granular variance decomposition for each forecast:
- The predictive mean for asset $j$ decomposes into endogenous and exogenous contributions:
\[
\mu_{j,t+1} = (F_{j,t+1}^{\text{endog}})^T a_{j,t+1}^{\text{endog}} + (F_{j,t+1}^{\text{exog}})^T a_{j,t+1}^{\text{exog}}
\]
- Summing absolute values of coefficient vectors $\phi_{j,t}$ vs.\ $\gamma_{j,t}$ enables a time series of “endogenous vs.\ exogenous signal strength,” empirically found to be predictive of subsequent variance moves.
- Change-point statistics on these signals facilitate interpretable financial forecasting, including the construction of “directional” portfolios responsive to endogenous/exogenous regime shifts.

## 7. Empirical Performance and Applications

Empirical studies benchmark H-SGDLM and its variants on large universes of equities and derivatives:
- On 487 European stocks (2001–2019), one-step median absolute deviation in $\log$-realized variance is 0.013 for H-SGDLM, outperforming classical HAR-RV (0.012) and SGDLM (0.015).
- H-SGDLM captures large one-day-ahead moves with 63.89% coverage inside an 18.06%-wide forecast interval, compared to 53.24% (HAR-RV) and 34.69% (SGDLM). For positive jumps $>10.04\%$, H-SGDLM achieves 63.95% correctness.
- On S&P 500 data, out-of-sample accuracy for large jumps is 65.93% (vs. 54.21% for HAR-RV).
- Variance-decomposition-derived signals, when used for change-point-timed equal-weight portfolios, yield steadily increasing cumulative returns over multi-year periods including stress episodes such as the 2008 crisis.
- Thresholded signals deliver >60% directional forecasting accuracy for the STLFSI Financial Stress Index when applied to S&P 500 subsets.
- GPU acceleration yields real-time inference for up to 500 assets with $K\approx10$ parent connections and several hundred Monte Carlo recoupling steps per update.

## 8. Context, Significance, and Research Directions

H-SGDLM provides a unified framework for:
- Multi-horizon volatility modeling (via HAR-RV), 
- Dynamic graphical network discovery (via time-varying sparse $\Gamma_t$), 
- Fully Bayesian inference in high dimensions (via Normal–Gamma and Variational Bayes decoupling), and
- Interpretable variance attribution across endogenous/exogenous factors.

The approach overcomes the scalability, flexibility, and interpretability limitations of classical co-integration and factor models, facilitating real-time high-dimensional inference and portfolio construction for financial and econometric applications [1905.05841][1904.08153]. 

The method's capacity for interpretable decomposition, efficient implementation, and robust empirical performance underpins its adoption for risk management, mean-reverting portfolio discovery, and higher-order market structure analysis. Future extensions may involve alternative network learning strategies, alternative Bayesian shrinkage priors, or applications to non-financial multivariate time series.

Source: https://www.emergentmind.com/topics/heterogeneous-simultaneous-graphical-dlm-h-sgdlm