tnagler/VineCopula

VineCopula; RStudio Version 1.3.959: contour rvinematrixe

hayet-ben-haj-hamida opened this issue · 2 comments

Hi, I am working on VineCopula, I would like to showing the name of variable on my contour plot, but I can't do this? the name of variables are showing only on the plot of tree

Yes, the contour plots don't use the variable names. If you want more control, you need to write your own code. Here's an example you can use as a basis:

# some 3-dimensional vine 
d <- 3
strucmat <- matrix(c(3,   1, 2, 0, 2, 1, 0, 0, 1), 3, 3)
fammat   <- matrix(c(0,   1, 23, 0, 0, 3, 0, 0, 0), 3, 3)
parmat   <- matrix(c(0, 0.3, -3, 0, 0, 1, 0, 0, 0), 3, 3)
par2mat  <- matrix(c(0,   0, 0, 0, 0, 0, 0, 0, 0), 3, 3)
RVM  <- RVineMatrix(strucmat, fammat, parmat, par2mat)
RVM$names <- c("Var 1", "Var 2", "Var 3")

# plots
par(mfrow = c(d - 1, d - 1))
for (j in seq.int(2, d)) {
  for (k in seq_len(d - 1)) {
    if (k < j) {
      contour(
        BiCop(RVM$family[j, k], RVM$par[j, k], RVM$par2[j, k]),
        xlab = RVM$names[RVM$Matrix[j, k]],
        ylab = RVM$names[RVM$Matrix[k, k]],
        main = VineCopula:::get_name(k, d + 1 - j, RVM)
      )
    } else {
      plot.new()
    }
  }
}

Thank you very much, just for one variable I have in the plot "," that separates the two word of the name of the same variable