### Risk Analysis with Copula

• Copulas have become a popular multivariate modeling tool in many fields where multivariate dependence is of interest and the usual multivariate normality is in question.

• A copula is a multivariate distribution whose marginals are all uniform over (0, 1).

• For a p-dimensional random vector $$U$$ on the unit cube, a copula $$C$$ is $C(u_1,...,u_p)=Pr(U_1 \leq u_1,...,U_p \leq u_p).$

• Combined with the fact that any continuous random variable can be transformed to be uniform over (0, 1) by its probability integral transformation, copulas can be used to provide multivariate dependence structure separately from the marginal distributions

• Let $$F$$ be a $$p$$-dimensional distribution function with margins $$F_1,..., F_p$$.

• Sklar(1959) first showed that there exists a p-dimensional copula $$C$$ such that for all $$x$$ in the domain of $$F$$, $F(x_1, ... , x_p) = C\{F_1(x_1), ... , F_p(x_p)\}.$

• Different kinds of Copula: Elliptical Copula : (i) Multivariate Gaussian Copula, (ii) Multivariate t-Copula

• Clayton (1978), Frank (1979), Gumbel (1960) are three cases of Archimedean Copulas

• Ref : Jun Yan, (2007) Enjoy the Joy of Copulas: With a Package copula, Journal of Statistical Software

library(PortRisk)
## Loading required package: MCMCpack
## Loading required package: coda
## Loading required package: MASS
## ##
## ## Markov Chain Monte Carlo Package (MCMCpack)
## ## Copyright (C) 2003-2016 Andrew D. Martin, Kevin M. Quinn, and Jong Hee Park
## ##
## ## Support provided by the U.S. National Science Foundation
## ## (Grants SES-0350646 and SES-0350613)
## ##
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
##     as.Date, as.Date.numeric
## Loading required package: copula
## Loading required package: tseries
# load the data 'SnP500Returns'
data(SnP500Returns)

# consider the portfolio containing the stocks of the companies
# Apple, IBM, Intel, Microsoft
pf <- c("AAPL","IBM","INTC","MSFT")

# suppose the amount of investments in the above stocks are

# $10,000,$40,000, $20,000 &$30,000 respectively

wt <- c(10000,40000,20000,30000) # weights

# risk attribution for the portfolio 'pf' with weights 'wt'
# for the time period January 1, 2013 - January 31, 2013

fit<-risk.attrib.Copula(tickers = pf
, weights = wt
, data = SnP500Returns
, start = "2013-01-01"
, end = "2013-01-31"
, sim.size = 1000
, df=15)
fit$Volatility ## weight vol mctr cctr ## AAPL 10000 0.03505336 2.0614388 0.2061439 ## IBM 40000 0.01169305 0.9297546 0.3719018 ## INTC 20000 0.01948613 1.2062182 0.2412436 ## MSFT 30000 0.01194353 0.9228293 0.2768488 fit$Portfolio Volatility
## [1] 1.096138
fit$Portfilio VaR ## 1% 5% ## -2267.739 -1220.453 fit$Total Portfolio Value
## [1] 1e+05