# We simulate from a conditional copula
set.seed(1)
N = 200
Z = rnorm(n = N, mean = 5, sd = 2)
conditionalTau = -0.9 + 1.8 * pnorm(Z, mean = 5, sd = 2)
simCopula = VineCopula::BiCopSim(N=N , family = 1,
par = VineCopula::BiCopTau2Par(1 , conditionalTau ))
X1 = qnorm(simCopula[,1])
X2 = qnorm(simCopula[,2])
newZ = seq(2,10,by = 0.1)
range_h = 3:10
resultCV <- CKT.hCV.l1out(X1 = X1, X2 = X2, Z = Z,
range_h = range_h, nPairs = 100)
resultCV <- CKT.hCV.Kfolds(X1 = X1, X2 = X2, Z = Z,
range_h = range_h, ZToEstimate = newZ)
plot(range_h, resultCV$scores, type = "b")
Run the code above in your browser using DataLab