# NOT RUN {
para <- list(cop1=PLACKETTcop, para1=.2, cop2=GLcop, para2=1.2)
densityCOPplot(cop=glueCOP, para=para, glue=0.6) #
# }
# NOT RUN {
# }
# NOT RUN {
# Concerning Nelsen (2006, exer. 3.3, pp. NN)
# Concerning Erdely (2017, exam. 5.1, p. 71)
# Concerning Erdely (2017, exam. 5.2, p. 75
# Nelsen's example is a triangle with vertex at [P,1].
# Erdley's example permits the construction using glueCOP from M and W.
"coptri" <- function(u,v, para=NA, ...) {
p <- para[1]; r <- 1 - (1-p)*v
if(length(u) > 1 | length(v) > 1) stop("only scalars for this function")
if(0 <= u & u <= p*v & p*v <= p) { return(u)
} else if( 0 <= p*v & p*v < u & u < r) { return(p*v)
} else if( p <= r & r <= u & u <= 1 ) { return(u+v-1)
} else { stop("should not be here in logic") }
}
"UsersCop" <- function(u,v, ...) { asCOP(u,v, f=coptri, ...) }
para <- list(cop1=M, cop2=W, para1=NA, para2=NA, glue=0.35)
UV <- simCOP(cop=UsersCop, para=0.35, cex=0.5, pch=16)
UV <- simCOP(cop=glueCOP, para=para, col=2, ploton=FALSE)
# We see in the plot that the triangular copulas are the same.
# For P = 0.5, Erdley shows Spearman Rho = 2*P-1 = 0, but
# Schweizer-Wolff = P^2 + (P-1)^2 = 0.5, let us check these:
rhoCOP( cop=glueCOP, para=para, glue=0.5) # -2.181726e-17
wolfCOP(cop=glueCOP, para=para, glue=0.5) # 0.4999953
# So rhoCOP() indicates independence, but wolfCOP() indicates
# dependence at the minimum value possible for a triangular copula.
# }
Run the code above in your browser using DataLab