Are there libraries in R for estimating time-varying joint distributions via copulas?

Hedibert Lopes has an excellent paper on the topic here. I know there is an existing packaged called copula but it fits a static copula.

  • 2
    $\begingroup$ if i have time over the summer i can implement this myself it sounds like a good project $\endgroup$ – pyCthon Mar 5 '12 at 17:42
  • 1
    $\begingroup$ This was similar stats.stackexchange.com/questions/19431/… but probably not that helpful, as I think Quant Guy actually answered that question! $\endgroup$ – Ellie Kesselman Mar 7 '12 at 4:16
  • $\begingroup$ @FeralOink - ha! Thanks but unfortunately that link isn't a solution $\endgroup$ – Ram Ahluwalia Mar 7 '12 at 4:36
  • $\begingroup$ I kind of suspected as much! Would it be useful to you if I listed some R libraries that have been used for the purpose of estimating time varying joint distributions for/ via copulas that I haven't used personally? I have a few in mind, from citations in papers. $\endgroup$ – Ellie Kesselman Mar 7 '12 at 4:40
  • 1
    $\begingroup$ So what happened? $\endgroup$ – Bob Jansen Mar 31 '12 at 16:41

I think an extremely interesting strand of research on this topic is represented by extensions of vine copulas with time-varying parameters.

For vine copulas in general have a look at this site from the Technische Universität München:
Vine Copula Models

One of their research projects, which is the most relevant in this context, is:
Time varying vine copula models

It is well worth keeping an eye on since they implement their research models in R, concerning the current status of the implementation please have a look at this presentation here:
CDVine: An R-package for statistical inference of C- and D-vines

You'll find the respective package CDVine on CRAN: Here

The vignette can be found in the Journal of Statistical Software.

(I will update this post when the new code for the time-varying parameters becomes available.)


Once we start building time-varying copulas like Lopes suggests in that paper, I think we are better off venturing into the world of state space models. When viewed in a bayesian context, the similarities between the approaches are striking to me. The advantage of the copula, as I understand it, is that it is a quick and dirty way to understand the structure of your marginal distributions by simplifying the dependence structure over time.

I did not find anything in the Lopes paper to suggest what algo he uses to estimate the params of his time-varying copulas and marginals, but I expect that this is done using something like a forward/backward algorithm (used in ssm estimation) since he mentions that the marginals and copulas are estimated in the same "step". There are great open source ssm packages that you could extend in R and python, if this approach interests you: sspir, dlm, MARSS, rbugs, pyssm, pymcmc, etc.

  • $\begingroup$ I think this answer is not very helpful. It is very general (long list of more or less unrelated packages) and doesn't really address the point. At least the links to the packages could have been given. $\endgroup$ – vonjd Jan 18 '13 at 7:29
  • $\begingroup$ @vonjd late better than never ... my point is pretty darn specific :: "time-varying copula" is an academic exercise -- if you want to understand the dependence structure between your variables over time, you are introducing a graphical model. Call it whatever floats your boat. Hopefully my answer will direct others considering this approach to graphical models. Voila two great places to start a search: cran and pypi. $\endgroup$ – egbutter Feb 9 '13 at 16:06

I have written R code for some time-varying bivariate fat-tailed copula functions (ripped off Patton's Matlab code) and played around with various optimizers.

You can then use Rsolnp, nloptr, alabama or DEoptim packages to find an optimisation solution. Here is some R code where I play around with different optimisation algorithms. Note that the data2.csv is just a 2 column of doubles with no rownames and no Header.

Unfortunately numerical MLE is very slow even with 1000 datapoints ... I would be VERY interested in seeing an iterative state space solution, if tractable. However, I somehow doubt one has been developed since this only came around in 2006 and is mostly popular among international economics researchers who are focused on applied questions with low frequency data (hence numerical MLE is fine for them).

  • $\begingroup$ Hi Jase,I could not open the url for time-varying copula. could you help me and offer a new url for me to download your R code and study it? Thanks very much! $\endgroup$ – eric May 23 '14 at 3:33
  • $\begingroup$ Hi jase, did you see my last message? Thanks. $\endgroup$ – eric May 24 '14 at 15:49

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.