I have to do an empirical analysis for a statistics paper. For this I want to show the differences of dependence structure for a specific data set.

So I selected 2 stock prices, transformed them into the returns and started to measure the dependency with R. So far it is no problem, I have a result for Bravais-Pearson, Kendall and Spearman. Additionally I plotted the regression model for this two values.

I have read in many papers, according to Sklar's Theorem, that it is easy to get the copula function out of the distribution function, just by use the inverse.

So my question is, if there is a possibility with R to plot the copula function (and density) just by having this data set (2 returns) or if I must first estimate the parameters to be able to plot this function.

And how can I do this with R? I tried to search the answer in the handbook of the package "copula", but my search wasn't really helpful.

Thanks in advance for your help!


1 Answer 1


Sklar's Theorem is very powerful and reads quite easy, but in practice one will have to know the (analytical) distributions before any "inverse" can be applied. Without knowing the exact joint and marginal distributions, one can still plot the empirical copula of a data set. At times, these plots reveal e.g. asymmetric patterns that can not be captured with correlation coefficients.

Typically, the scaled ranks of a data set (scaled to the interval (0,1)) are a good estimate of a non-parametric inverse of the marginal distributions. An empirical copula's density can then be represented as a scatter plot of the data's scaled ranks. As the spread of (many) points is at times hard to grasp, a smoothed scatter plot provides a visual proxy of the empirical copula's density (see e.g. the function "smoothScatter" from the (base) graphics package or "dependencePlot" in the package spcopula available from r-forge). In case one does know the marginal distributions, one can of'course replace the scaled ranks by the marginally "inverted" data.

In case one does know the copula's family and corresponding parameter(s) (sometimes a 1-1 relationship with Kendall's tau), 3D-plots of the copula can be obtained using the function "persp" with a copula and PDF/CDF function:

persp(claytonCopula(2), dCopula) # plotting the PDF
persp(claytonCopula(2), pCopula) # plotting the CDF

The package copula provides as well the function "fitCopula" that helps to estimate a copula's parameter(s) using different estimators.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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