I’ve made some progress implementing a log-stochastic volatility model. The model is described on page 54 in the paper I referenced in my initial comment. I’m using the AR time-series distribution to model the log volatility process

My next step is to incorporate correlation between the stochastic return process and the stochastic log-volatility process (page 56). I’m not sure how to do this in PyMC3. I’m wondering if I can replace the AR process with a MVGuassianRandomWalk

Code for log-stochastic volatility below:

#Log Stochastic Volatility

import numpy as np

import matplotlib.pyplot as plt

import pymc3 as pm

returns = np.genfromtxt(pm.get_data(“SP500.csv”))

with pm.Model() as sp500_model:

```
alpha=pm.Normal('alpha',0,sd=100)
beta=pm.Normal('beta',0,sd=10)
sigmaV=pm.InverseGamma('sigmaV',2.5,0.1)
logV = pm.AR('logV', [alpha,beta], sd=sigmaV**.5,constant=True,shape=len(returns))
volatility_process = pm.Deterministic('volatility_process', pm.math.exp(.5*logV))
r = pm.Normal('r', mu=0,sd=volatility_process, observed=returns)
```

with sp500_model:

trace = pm.sample(2000,chains=1,cores=1)

pm.traceplot(trace, [alpha,beta,sigmaV]);