 # Multivariate stochastic volatility

Hi. I’m trying to run stochastic volatility model on panel data (n_times x m_assets), and while I scaled the documented example (Example: Stochastic Volatility — NumPyro documentation) to multiple assets (thanks to some help from @fehiepsi), now I also would like to extend the model to fit asset correlations. I understand that multivariate SV models, or time-varying covariance models may be non-trivial, but I wonder if there are simple things I could try (perhaps assume that correlation is constant through time) and get a better fit out of my model while preserving correlations in the posterior predictive samples.

Right now my model has the following structure:

``````def model(data):

n_times, n_assets = data.shape

# hyperpriors
sigma_lam = ...
nu_lam = ...

with numpyro.plate('asset', n_assets, dim=-1):
# volatility priors
sigma = numpyro.sample('sigma', dist.Exponential(sigma_lam))
h = numpyro.sample(
'log-volatility',
dist.GaussianRandomWalk(scale=sigma, num_steps=n_times)
)
v = numpyro.deterministic('volatility', jnp.exp(-2 * h))

# returns' normality prior
nu = numpyro.sample('nu', dist.Exponential(nu_lam)).reshape(-1, 1)

# likelihood distribution
dist_kwargs = {
'df': nu,
'loc': jnp.zeros((n_assets, 1)),
'scale': v
}
like_dist = dist.StudentT(**dist_kwargs).to_event(1)

# likelihood
y = numpyro.sample('y_like', like_dist, obs=data)

return y
``````

Naive attempts to use multivariate likelihood and construct a covariance prior (with Cholesky decomposition) fail because volatility matrix `v` is not square (as it is time-varying stochastic volatility). I also tried introducing a second `.plate` statement along the time dimension and updating a covariance prior at each time point, but I couldn’t quite figure out how to make it work, and even if I could, I suspect it would be computationally inefficient. I was also thinking of introducing a shared factor or component into the model to induce correlations (but haven’t tried anything specific yet).

If you have any thoughts or suggestions on this, please share. Thank you!