1
$\begingroup$

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 ?

Thanks for your time.

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

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.

$\endgroup$
  • $\begingroup$ thank you very much. How can I cite this code ? $\endgroup$ – peter5 Apr 9 at 5:47
  • $\begingroup$ @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! $\endgroup$ – Taylor Apr 9 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.