0

I want to study mixture Copula for reliability analysis.however I can't construct RVINEMatrix , Therefore, the probability integral transformation (PIT) cannot be performed、 The copula used in H-equation to convert related variables into independent variables cannot be filled with mixed copulas。 Here is my code:

    copula1 <- mixCopula(list(claytonCopula(param = 1.75,dim = 2),
                          frankCopula(param = 0.718,dim = 2),
                          gumbelCopula(param = 1.58,dim = 2)),w=c(0.4492,0.3383,0.2125))
    copula2 <- mixCopula(list(frankCopula(param = 0.69,dim = 2),
                          gumbelCopula(param = 1.48,dim = 2),
                          claytonCopula(param = 1.9,dim = 2)),w=c(0.3784,0.3093,0.3123))
    copula3 <- mixCopula(list(frankCopula(param = 7.01,dim = 2),
                          claytonCopula(param = 0.75,dim = 2),
                          gumbelCopula(param = 1.7,dim = 2)),w=c(0.4314,0.2611,0.3075))
    copula4 <- mixCopula(list(gumbelCopula(param = 1.21,dim = 2),
                          claytonCopula(param = 0.89,dim = 2),
                          frankCopula(param = 3.62,dim = 2)),w=c(0.3306,0.2618,0.4076))
     .......
    Matrix <- c (5, 4, 3, 2, 1,
            0, 4, 3, 2, 1,
            0, 0, 3, 2, 1,
            0, 0, 0, 2, 1,
            0, 0, 0, 0, 1)
    Matrix <- matrix(Matrix, 5, 5)

    family1 <- c(0,copula10,copula9,copula7, copula4,
                0, 0,  copula8,copula6,  copula3,
                0, 0, 0,  copula5, copula2,
                0, 0, 0, 0,  copula1,
                0, 0, 0, 0, 0)
    family1 <- matrix(family1, 5, 5)


    par <- c(0,  0.2, 0.5,0.32, 0.50,``
         0, 0, 0.5, 0.98, 0.5,
         0, 0, 0,  0.9 , 0.5,
         0, 0, 0, 0, 0.39,
         0, 0, 0, 0, 0)
    par <- matrix(par, 5,  5)

    par2 <- c(0, 0, 0, 0, 0,
              0, 0, 0, 0, 0,
              0, 0, 0, 0, 0,
              0, 0, 0, 0, 0,
               0, 0, 0, 0, 0)
    par2 <- matrix(par2, 5, 5)
     RVM <- RVineMatrix(Matrix = Matrix, family = family1,
                   par = par, par2 = par2,
                   names = c("V1", "V2", "V3", "V4", "V5"),check.pars = TRUE)

so could you help me to construct the rvinematrix ? or Achieve this by other means. thanks!

HIteWIng
  • 33
  • 5

1 Answers1

0

There are some points you should be aware of:

  1. You use the mixcopula from the copula package. That will provide you with a mixture model with a copula, not a mixture of R-vine copula.
  2. Then you try to fit the copula generated from the mixture of copula into the Rvine copula model. This will not work because the index for copula functions in the R-vine copula is different from the one in the copula package. So, Rvine matrix accepts only a number, where each number corresponds to a specific type of copula.

So, to build a mixture of the R-vine copula model, you should build a mixture of R-vine densities. There exist a clustering GitHub package, called vineclust. It is designed for vine copula clustering models. By the way, for the mixture of Rvine copula, you need (for two components), two matrices of families, parameters, and Matrix.

An example of vine mixture from vineclust is:

dims <- 3
obs <- c(500,500) 
RVMs <- list()
RVMs[[1]] <- VineCopula::RVineMatrix(Matrix=matrix(c(1,3,2,0,3,2,0,0,2),dims,dims),
                        family=matrix(c(0,3,4,0,0,14,0,0,0),dims,dims),
                        par=matrix(c(0,0.8571429,2.5,0,0,5,0,0,0),dims,dims),
                        par2=matrix(sample(0, dims*dims, replace=TRUE),dims,dims)) 
RVMs[[2]] <- VineCopula::RVineMatrix(Matrix=matrix(c(1,3,2,0,3,2,0,0,2), dims,dims),
                        family=matrix(c(0,6,5,0,0,13,0,0,0), dims,dims),
                        par=matrix(c(0,1.443813,11.43621,0,0,2,0,0,0),dims,dims),
                        par2=matrix(sample(0, dims*dims, replace=TRUE),dims,dims))
margin <- matrix(c('Normal', 'Gamma', 'Lognormal', 'Lognormal', 'Normal', 'Gamma'), 3, 2) 
margin_pars <- array(0, dim=c(2, 3, 2))
margin_pars[,1,1] <- c(1, 2)
margin_pars[,1,2] <- c(1.5, 0.4)
margin_pars[,2,1] <- c(1, 0.2)
margin_pars[,2,2] <- c(18, 5)
margin_pars[,3,1] <- c(0.8, 0.8)
margin_pars[,3,2] <- c(1, 0.2)
x_data <- rvcmm(dims, obs, margin, margin_pars, RVMs)
Dr. Alenezi
  • 141
  • 6
  • yes ,The answer is very useful to me. I have another question to ask you, I want to take the probability integral transformation(PIT) of the initial data transform to [0,1],But In the above method , the RvinePIT could't perform ,You can browse my questions on my homepage questions,I really appreciate your help !!! – HIteWIng Aug 09 '22 at 10:39
  • Ok. First, if you find the answer helpful, then you can accept it by selecting the mark icon (if you wish). What do you mean by `your homepage questions`? – Dr. Alenezi Aug 09 '22 at 11:14
  • You can go to my Stack Overflow homepage .Because of the word limit in comments section,I put up a new problem on my homepage,thanks – HIteWIng Aug 09 '22 at 12:13