Kendall’s function for copulas

[This article was first published on Freakonometrics - Tag - R-english, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

As mentioned in the course on copulas, a nice tool to describe dependence it Kendall’s cumulative function. Given a random pair https://i0.wp.com/freakonometrics.blog.free.fr/public/perso6/conc-19.gif?w=578 with distribution  https://i1.wp.com/freakonometrics.blog.free.fr/public/perso6/conc-17.gif?w=578, define random variable https://i2.wp.com/freakonometrics.blog.free.fr/public/perso6/conc-30.gif?w=578. Then Kendall’s cumulative function is

https://i0.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-01.gif?w=578

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://i2.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-02.gif?w=578, compute https://i2.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-03.gif?w=578 as the proportion of observation in the lower quadrant, with upper corner https://i1.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-4.gif?w=578, i.e.

https://i1.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-06.gif?w=578

  • then compute the cumulative distribution function of https://i2.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-03.gif?w=578‘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://i0.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-7.gif?w=578, then Kendall’s function is simply

https://i0.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-8.gif?w=578

If 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://i1.wp.com/freakonometrics.blog.free.fr/public/perso6/kendall-function-anim.gif?resize=450%2C249

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://i0.wp.com/freakonometrics.blog.free.fr/public/perso6/kennnn-04.gif?w=578, and the case of independence, the upper green curve, https://i1.wp.com/freakonometrics.blog.free.fr/public/perso6/kennnnn-05.gif?w=578. It should also be mentioned that it is also common to plot not function https://i2.wp.com/freakonometrics.blog.free.fr/public/perso6/kennnn-01.gif?w=578, but function https://i2.wp.com/freakonometrics.blog.free.fr/public/perso6/kennnn-02.gif?w=578, defined as https://i0.wp.com/freakonometrics.blog.free.fr/public/perso6/kennnn-03.gif?w=578,



To leave a comment for the author, please follow the link and comment on their blog: Freakonometrics - Tag - R-english.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)