Copula Functions, R, and the Financial Crisis
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
From: In defense of the Gaussian copula, The Economist
“The Gaussian copula provided a convenient way to describe a relationship that held under particular conditions. But it was fed data that reflected a period when housing prices were not correlated to the extent that they turned out to be when the housing bubble popped.”
Decisions about risk, leverage, and asset prices would very likely become more correlated in an environment of centrally planned interest rates than under ‘normal’ conditions.
Simulations using copulas can be implemented in R. I’m not an expert in this, but thanks to the reference Enjoy the Joy of Copulas: With a Package copula I have at least gained a better understanding of copulas.
A copula can be defined as a multivariate distribution with marginals that are uniform over the unit interval (0,1). Copula functions can be used to simulate a dependence structure independently from the marginal distributions.
Based on Sklar’s theorem the multivariate distribution F can be represented by copula C as follows:
# *------------------------------------------------------------------ # | PROGRAM NAME: R_COPULA_BASIC # | DATE: 1/25/11 # | CREATED BY: Matt Bogard # | PROJECT FILE: P:\R Code References\SIMULATION # *---------------------------------------------------------------- # | PURPOSE: copula graphics # | # *------------------------------------------------------------------ # | COMMENTS: # | # | 1: REFERENCES: Emjoy the Joy of Copulas: With a Package copula # | Journal of Statistical Software Oct 2007, vol 21 Issue 1 # | http://www.jstatsoft.org/v21/i04/paper # | 2: # | 3: # |*------------------------------------------------------------------ # | DATA USED: # | # | # |*------------------------------------------------------------------ # | CONTENTS: # | # | PART 1: # | PART 2: # | PART 3: # *----------------------------------------------------------------- # | UPDATES: # | # | # *------------------------------------------------------------------ library("copula") set.seed(1) # *------------------------------------------------------------------ # | # |scatterplots # | # | # *----------------------------------------------------------------- # normal (Gausian?) Copula norm.cop <- normalCopula(2, dim =3) norm.cop x <- rcopula(norm.cop, 500) plot(x) title("Gaussian Copula") # Clayton Copula clayton.cop <- claytonCopula(2, dim = 2) clayton.cop y <- rcopula(clayton.cop,500) plot(y) title("Clayton Copula") # Frank Copula frank.cop <- frankCopula(2, dim = 2) frank.cop f <- rcopula(frank.cop,500) plot(f) title("Frank Copula") # Gumbel Copula gumbel.cop <- gumbelCopula(2, dim = 2) gumbel.cop g <- rcopula(gumbel.cop,500) plot(g) title('Gumbel Copula') # *------------------------------------------------------------------ # | # | contour plots # | # | # *----------------------------------------------------------------- # clayton copula contour myMvd1 <- mvdc(copula = archmCopula(family = "clayton", param = 2), margins = c("norm", "norm"), paramMargins = list(list(mean = 0, sd = 1), list(mean = 0, sd = 1))) contour(myMvd1, dmvdc, xlim = c(-3, 3), ylim = c(-3, 3)) title("Clayton Copula") # frank copula contour myMvd2 <- mvdc(copula = archmCopula(family = "frank", param = 5.736), margins = c("norm", "norm"), paramMargins = list(list(mean = 0, sd = 1), list(mean = 0, sd = 1))) contour(myMvd2, dmvdc, xlim = c(-3, 3), ylim = c(-3, 3)) title("Frank Copula") # gumbel copula myMvd3 <- mvdc(copula = archmCopula(family = "gumbel", param = 2), margins = c("norm", "norm"), paramMargins = list(list(mean = 0, sd = 1), list(mean = 0, sd = 1))) contour(myMvd3, dmvdc, xlim = c(-3, 3), ylim = c(-3, 3)) title("Gumbel Copula")
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.