# Clayton and rotated Clayton copulas
n <- 1000
tau <- 0.5
# simulate from Clayton copula
fam <- 3
theta <- BiCopTau2Par(fam, tau)
set.seed(123)
dat <- BiCopSim(n, fam, theta)
# create lambda-function plots
par(mfrow = c(1, 3))
BiCopLambda(dat[, 1], dat[, 2]) # empirical lambda-function
BiCopLambda(family = fam, par = theta) # theoretical lambda-function
BiCopLambda(dat[, 1], dat[, 2], family = fam, par = theta) # both
# lambda-function of estimated copula
fit <- BiCopSelect(dat[, 1], dat[, 2])
par(mfrow = c(1, 1))
BiCopLambda(fit)
# simulate from rotated Clayton copula (90 degrees)
fam <- 23
theta <- BiCopTau2Par(fam, -tau)
set.seed(123)
dat <- BiCopSim(n, fam, theta)
# rotate the data to standard Clayton copula data
rot_dat <- 1 - dat[, 1]
par(mfrow = c(1, 3))
BiCopLambda(rot_dat, dat[, 2]) # empirical lambda-function
BiCopLambda(family = 3, par = -theta) # theoretical lambda-function
BiCopLambda(rot_dat, dat[, 2], family = 3, par = -theta) # both
Run the code above in your browser using DataLab