Search code examples
rcopula

how to estimate copula parameter value for three-dimension copula function?


Hello,in R language, i want to calculate copula parameter θ and the AIC value of the three-dimension copula function(not for vine copula), is there a relevant package and function to calculate directly? as I know,for two-dimension copula(or for vine copula),there are some functions like BiCopEst() and RVineAIC(). However,when I fitCopula,how to calculate the AIC value of the three-dimension copula function is a question for me. could everybody help me? Thanks!

### data 
x1 <- rnorm(1000,mean = 8,sd = 2)
x2 <- rnorm(1000,mean = 4,sd = 1)
x3 <- rnorm(1000,mean = 5,sd = 0.5)
u  <- matrix(c(x1,x2,x3),1000,3)
ux1 <- ecdf(x1)
ux1 <- ux1(x1)
ux2 <- ecdf(x2)
ux2 <- ux2(x2)
ux3 <- ecdf(x3)
ux3 <- ux3(x2)
data1<-matrix(c(ux1,ux2,ux3),1000,3)
###fit copula 
clay.cop <- fitCopula(claytonCopula(dim = 3), data1, method = "itau")
### then how to get AIC for this copula?

Solution

  • Here you go, based on your provided data.

    x1 <- rnorm(1000,mean = 8,sd = 2)
    x2 <- rnorm(1000,mean = 4,sd = 1)
    x3 <- rnorm(1000,mean = 5,sd = 0.5)
    Copdat <- pobs(cbind(x1,x2,x3))
    ###fit copula 
    clay.cop <- fitCopula(claytonCopula(dim = 3),Copdat)
    

    Output

    > clay.cop
    Call: fitCopula(claytonCopula(dim = 3), data = Copdat)
    Fit based on "maximum pseudo-likelihood" and 1000 3-dimensional observations.
    Copula: claytonCopula 
      alpha 
    0.02053 
    The maximized loglikelihood is 0.5753 
    Optimization converged
    

    To calculate the AIC, use its equation directly, where the loglikelihood is the one given in the result, and the number of the parameters is the estimated parameter; for your case, it is only the parameter of the Clayton copula.

    AIC = -2 loglikelihood + 2 p ## p is the number of the estimated parameters of the model.