I'm working in order to compare the calculation of the VaR between the methodology of copulas and kernel density, all this by using the software r.
The process that I follow is:
- Obtain a sample (which is bivariate)
- Estimate the density of the data by kernel of Epanechnikov (for X1 and X2 as marginals)
- Calculate the bandwith with the rule of thumb (Silverman)
- Fix a copula (Gumbel or Clayton)
- I calculate the VaR (quantile 0.95)
But if I do this I obtain a value that correspond to the estimated data, I have found a working paper that in relation with the process add another step:
Estimate the pdf of the jth order statistic.
Agarwal, Ravi Kumar and Ramakrishnan, Vignesh, Epanechnikov Kernel Estimation of Value at Risk (January 14, 2010).
set.seed(1) data<-rnorm(518,10,3) #Calculate rule-of-thumb bandwidth sx<-apply(data,2,sd) b1 <-1.06*sx[1,]*n^(-1/5) b2 <-1.06*sx[2,]*n^(-1/5) #Kernel density estimation "epanechnikov" d1=density(data[,1],bw=b1,kernel="epanechnikov") d2=density(data[,2],bw=b2,kernel="epanechnikov") data_E <- cbind(d1$y,d2$y) #Fixing a copula (Gumbel) r<-Kendall(data_E) P<-1/(1-r[1,2]) m1<- fit.norm(data_E[,1]) m2<- fit.norm(data_E[,2]) rep <- 100000 gcopula <- rcopula.gumbel(rep,theta=P, d=2) c1 <- qnorm(gcopula[,1],mean=m1$mu,sd=sqrt(m1$Sigma)) c2 <-qnorm(gcopula[,2],mean=m2$mu,sd=sqrt(m2$Sigma)) dataGUM<-cbind(c1, c2) alfa=0.95 quantile(dataGUM, alfa)
As I have exposed the value of the quantile at 0.95 correspond to my estimated data "data_E" and not to the original one "data", there is a way that I could find it?