Check tail dependencies NIFTY-Gold
Purpose
To look at tail dependencies of assets and see whether the assets display tail dependencies . Data prep - temp.ret has all the relevant data
> n <- dim(temp.ret)[1] > GetChiPlotData <- function(z) { + n <- dim(z)[1] + x <- array(z[, 1]) + y <- array(z[, 2]) + Fi <- apply(x, 1, function(temp) length(which(x[which(x != + temp)] <= temp))/(n - 1)) + Gi <- apply(y, 1, function(temp) length(which(y[which(y != + temp)] <= temp))/(n - 1)) + Hi <- apply(z, 1, function(temp) length(which(x[which(x != + temp[1])] <= temp[1] && y[which(y != temp[1])] <= temp[2]))/(n - + 1)) + Chi <- (Hi - Fi * Gi)/sqrt(Fi * (1 - Fi) * Gi * (1 - Gi)) + Lambdai <- 4 * sign((Fi - 0.5) * (Gi - 0.5)) * pmax((Fi - + 0.5)^2, (Gi - 0.5)^2) + result <- cbind(Lambdai, Chi) + return(result) + } > cp <- 1.78 > z <- as.matrix(temp.ret[, c(1, 2)]) > z1c <- GetChiPlotData(z1) > master1 <- as.matrix(cbind(temp.ret[, c(1, 2)], z1c)) > z1.x <- quantile(master1[, 1], prob = seq(0, 1, 0.05))[17] > z1.y <- quantile(master1[, 2], prob = seq(0, 1, 0.05))[17] > condition1 <- (master1[, 1] > z1.x) & (master1[, 2] > z1.y) |
> par(mfrow = c(2, 2)) > plot(master1[, 1], master1[, 2], col = "blue", pch = 19, main = "NIFTY-Gold", + xlab = "X", ylab = "Y") > plot(master1[, 3], master1[, 4], pch = 19, col = "blue", ylim = c(-10, + 3), main = " Chi Plot- Nifty-Gold", xlab = "X", ylab = "Y") > abline(h = c(-1, 1) * cp/sqrt(n), col = "sienna", lwd = 2, lty = "dashed") > plot(master1[!condition1, 3], master1[!condition1, 4], pch = 19, + col = "blue", ylim = c(-10, 3), main = "Overall Chi Plot - N", + xlab = "X", ylab = "Y") > abline(h = c(-1, 1) * cp/sqrt(n), col = "sienna", lwd = 2, lty = "dashed") > plot(master1[condition1, 3], master1[condition1, 4], pch = 19, + col = "blue", ylim = c(-10, 3), main = "Overall Chi Plot - N", + xlab = "X", ylab = "Y") > abline(h = c(-1, 1) * cp/sqrt(n), col = "sienna", lwd = 2, lty = "dashed") |
One can clearly see that there is no evidence of tail dependence between the two assets.
Thus one can safely assume a gaussian copula!!