# Estimation - Taylor's Stochastic Volatility Model

I want to estimate Taylor's stochastic volatility model (fit on stock data).

Is there any package in R ? As far as I know, there is not a "standard" procedure in Eviews. Even a free-distributed matlab code ?

• any interest in c++ code? Apr 8 '19 at 12:39
• @Taylor, thank you for the immediate responce. Anything would help! Apr 8 '19 at 13:01
• @Taylor, is this your SV model? Apr 8 '19 at 17:01
• @Aksakal haha I wish, no. It's this guy's: lancaster.ac.uk/staff/afasjt/shortcv.htm Apr 8 '19 at 17:04
• @Taylor, I thought you might be "that guy" Apr 8 '19 at 18:15

Here's some c++ code based on the particle filtering library pf and the state space model estimation library ssme. All the files for this self-contained example are available here.

After downloading and building both of these libraries, navigate to the ssme/example directory, type make, and then something like

./main spy_returns.csv univ_svol_pmmh_samples univ_svol_pmmh_messages 1000


If you take a look at main.cpp, you'll notice that these arguments represent the name of the program, the file with your stock returns, the base of the name of the file you want to store your samples in, the same for the messages emitted from the program, and the number of iterations of your chain. Inside that file, you may also change the window that you adapt the proposal distribution's covariance matrix.

This program uses the pseudo-marginal approach by taking a particle filter's estimated likelihood at each iteration of the chain. This code here uses the original bootstrap filter, but if you would like to change this, change the file univ_svol_bootstrap_filter.h and instead subclass a different filter from here. If you want to increase or decrease the number of particles, that's back in main.cpp.

If you would like to change the priors, change estimate_univ_svol.h. Unlike Gibbs sampling, you can make the priors pretty much anything you feel like. Also in that file is the ability to turn off the option to use multiple cores.

• thank you very much. How can I cite this code ? Apr 9 '19 at 5:47
• @peter5 if you go to the main github pages, there are little zenodo DOI badges displayed at the top of the README. Clicking on them brings you to pages like this one, and at the bottom right there are citation export buttons. Thanks! Apr 9 '19 at 12:13