Tag Archives: copules

Copulas and Financial Time Series

I was recently asked to write a survey on copulas for financial time series. The paper is, so far, unfortunately, in French, and is available on https://hal.archives-ouvertes.fr/. There is a description of various models, including some graphs and statistical outputs, obtained from read data.

To illustrate, I’ve been using weekly log-returns of (crude) oil prices, Brent, Dubaï and Maya.

The dataset is available from an excel file, oil.xls (I thought it was possible to load it direclty from the internet, but it did not work… so I suggest to download the file first, and then load it)

> library(xlsx)
> temp <- tempfile()
> download.file(
+ "http://freakonometrics.free.fr/oil.xls",temp)
trying URL 'http://freakonometrics.free.fr/oil.xls'
Content type 'application/vnd.ms-excel' length 99328 bytes (97 KB)
downloaded 97 KB
> oil=read.xlsx(temp,sheetName="DATA",dec=",")
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
  java.io.IOException: block[ 0 ] already removed - does your POIFS have circular or duplicate block references?
> oil=read.xlsx("D:\\home\\acharpen\\mes documents\\oil.xls",sheetName="DATA")

Then we can plot those three time series

> head(oil)
        Date      WTI    brent   Dubai     Maya
1 1997-01-10  2.73672  2.25465  3.3673   1.5400
2 1997-01-17 -3.40326 -6.01433 -3.8249  -4.1076
3 1997-01-24 -4.09531 -1.43076 -6.6375  -4.6166
4 1997-01-31 -0.65789  0.34873  0.7326  -1.5122
5 1997-02-07 -3.14293 -1.97765 -0.7326  -1.8798
6 1997-02-14 -5.60321 -7.84534 -7.6372 -11.0549

> Time=as.Date(oil$Date,"%Y-%m-%d")
> plot(Time,oil[,3],type="l",ylab="Brent, weekly log returns",ylim=range(oil[,3:5]))

The idea is to use some multivariate ARMA-GARCH processes here. The heuristics here is that the first part is used to model the dynamics of the average value of the time series, and the second part is used to model the dynamics of the variance of the time series. Two kinds of models are considered in the paper

  • a mutivariate GARCH process (or a model on the dynamics of the variance matrix) on the residuals from the ARMA models
  • a multivariate model (based on copulas) on the residuals of the ARMA-GARCH process

Continue reading Copulas and Financial Time Series

Copules et valeurs extrêmes, syllabus

Le plan de cours pour le cours MAT8595 Copules et Valeurs Extremes est en ligne. L’entente d’évaluation sera signée au premier cours, ce lundi à 9:00 (salle SH-2140). D’autre billets seront mis en ligne dans les jours à venir, avec quelques exercices, et les articles qui serviront de base pour les projets, sur http://freakonometrics.hypotheses.org/courses/copulas-and-extremes.

Kendall’s function for copulas

As mentioned in the course on copulas, a nice tool to describe dependence it Kendall’s cumulative function. Given a random pair https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/conc-19.gif with distribution  https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/conc-17.gif, define random variable https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/conc-30.gif. Then Kendall’s cumulative function is

https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-01.gif

Genest and Rivest (1993) introduced that function to choose among Archimedean copulas (we’ll get back to this point below).

From a computational point of view, computing such a function can be done as follows,

  • for all https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-02.gif, compute https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-03.gif as the proportion of observation in the lower quadrant, with upper corner https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-4.gif, i.e.

https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-06.gif

  • then compute the cumulative distribution function of https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-03.gif‘s.

To visualize the construction of that cumulative distribution function, consider the following animation

Thus, here the code to compute simply that cumulative distribution function is

n=nrow(X)
i=rep(1:n,each=n)
j=rep(1:n,n)
S=((X[i,1]>X[j,1])&(X[i,2]>X[j,2]))
Z=tapply(S,i,sum)/(n-1)

The graph can be obtain either using

plot(ecdf(Z))

or

plot(sort(Z),(1:n)/n,type="s",col="red")

The interesting point is that for an Archimedean copula with generator https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-7.gif, then Kendall’s function is simply

https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-8.gifIf we’re too lazy to do the maths, at least, it is possible to compute those functions numerically. For instance, for Clayton copula,

h=.001
phi=function(t){(t^(-alpha)-1)}
dphi=function(t){(phi(t+h)-phi(t-h))/2/h}
k=function(t){t-phi(t)/dphi(t)}
Kc=Vectorize(k)

Similarly, let us consider Gumbel copula,

phi=function(t){(-log(t))^(theta)}
dphi=function(t){(phi(t+h)-phi(t-h))/2/h}
k=function(t){t-phi(t)/dphi(t)}
Kg=Vectorize(k)

If we plot the empirical Kendall’s function (obtained from the sample), with different theoretical ones, derived from Clayton copulas (on the left, in blue) or Gumbel copula (on the right, in purple), we have the following,

https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kendall-function-anim.gif

Note that the different curves were obtained when Clayton copula has Kendall’s tau equal to 0, .1, .2, .3, …, .9, 1, and similarly for Gumbel copula (so that Figures can be compared). The following table gives a correspondence, from Kendall’s tau to the underlying parameter of a copula (for different families)

as well as Spearman’s rho,


To conclude, observe that there are two important particular cases that can be identified here: the case of perfect dependent, on the first diagonal when https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kennnn-04.gif, and the case of independence, the upper green curve, https://f.hypotheses.org/wp-content/blogs.dir/253/files/2016/10/kennnnn-05.gif. It should also be mentioned that it is also common to plot not function https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kennnn-01.gif, but function https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kennnn-02.gif, defined as https://f.hypotheses.org/wp-content/blogs.dir/253/files/2015/12/kennnn-03.gif,

Copules et risques corrélés

https://blogperso.univ-rennes1.fr/arthur.charpentier/public/perso2/.copula-density-proj_m.jpg

J’avais promis dans un commentaire que je mettrais bientôt en ligne un survey sur les copules…. après plusieurs mois de retard, le document est en ligne [pdf], et il est sobrement intitulé copules et risques multiples. Toutes les remarques et critiques sont les bienvenues ! Il s’agit d’un chapitre pour un livre dont je mettrais la référence en ligne ultérieurement. A priori, ce document devrait servir de base pour le cours qui sera donné dans un mois au CIRM (mentionné ici, dans le cadre des Journées d’Études Statistiques).

Copules et processus empiriques

Tarek Zari a soutenu sa thèse au début du mois, présentant une “contribution  à l’étude du processus empirique de copule“, et sa thèse est en ligne ici. Je mets aussi une copie de ses slides . Historiquement, il semble que Frits Ruymgaart a été le premier a parler de processus empirique de copules, en 1973 (sa thèse est en ligne ici).

Paul Deheuvels avait également introduit la notion en copule empirique dès 1979 sous le nom de “fonction de dépendance empirique“. A la même époque, Ludger Rüschendorf proposait également une étude asymptotique des processus empiriques de copules (ici en 1976), ou encore Gäenssler et Stute dans leur seminar on empirical processes et Winfried Stute dans les années 80 (). Une revue de la littérature sur les processus empiriques multivariés a été publié à cette époque, en ligne . Depuis Jean-David Fermanian a publié un papier ici sur la convergence faible, et Paul Deheuvels ou Ludger Rüschendorf ont publié énormément de choses, en particulier sur la vitesse de convergence…