Generating correlated random variables using copulas


These routines make use of the R Copula library


Download sample code for generating joint samples with different copula routines [Here]


The function normal_copula can be used to explore the generation of joint samples from normal [xmean,xsd] and beta [xshape1,xshape2] distributions with different degrees of correlation

The routine is called as


where corrcoeff is a correlation parameter (0-1).  Shade (0-1) and viewing angle (in degrees) are optional parameters that change the perspective plot.  Default values are 0.5 and 45 degrees

The routine produces plots of the shape of the copula, the joint density and a random sample of values.

Other Gumbel and Frank copula forms can be tried using the routines:



These are both members of the Archimedian family of copulas and have a different range of correlation parameter in this implementation.   Try values of  copcoeff  up to +/- 50  for the Frank copula and in the range [0,10] for the Gumbel copula..

Many other forms of copula are available in the R Copula library.   They can be extended to more than 2 dimensions for multiple co-varying parameters.