Provides an interface to 'vinecopulib', a C++ library for vine copula modeling based on 'Boost' and 'Eigen'. The 'rvinecopulib' package implements the core features of the popular 'VineCopula' package, in particular inference algorithms for both vine copula and bivariate copula models. Advantages over 'VineCopula' are a sleeker and more modern API, improved performances, especially in high dimensions, nonparametric and multi-parameter families. The 'rvinecopulib' package includes 'vinecopulib' as header-only C++ library (currently version 0.6.2). Thus users do not need to install 'vinecopulib' itself in order to use 'rvinecopulib'. Since their initial releases, 'vinecopulib' is licensed under the MIT License, and 'rvinecopulib' is licensed under the GNU GPL version 3.

Author

Thomas Nagler, Thibault Vatter

Examples

## bicop_dist objects
bicop_dist("gaussian", 0, 0.5)
#> Bivariate copula ('bicop_dist'): family = gaussian, rotation = 0, parameters = 0.5, var_types = c,c
str(bicop_dist("gauss", 0, 0.5))
#> List of 5
#>  $ family    : chr "gaussian"
#>  $ rotation  : num 0
#>  $ parameters: num [1, 1] 0.5
#>  $ var_types : chr [1:2] "c" "c"
#>  $ npars     : int 1
#>  - attr(*, "class")= chr "bicop_dist"
bicop <- bicop_dist("clayton", 90, 3)

## bicop objects
u <- rbicop(500, "gauss", 0, 0.5)
fit1 <- bicop(u, family = "par")
fit1
#> Bivariate copula fit ('bicop'): family = gaussian, rotation = 0, parameters = 0.54, var_types = c,c

## vinecop_dist objects
## specify pair-copulas
bicop <- bicop_dist("bb1", 90, c(3, 2))
pcs <- list(
  list(bicop, bicop), # pair-copulas in first tree
  list(bicop) # pair-copulas in second tree
)
## specify R-vine matrix
mat <- matrix(c(1, 2, 3, 1, 2, 0, 1, 0, 0), 3, 3)
## build the vinecop_dist object
vc <- vinecop_dist(pcs, mat)
summary(vc)
#> # A data.frame: 3 x 10 
#>  tree edge conditioned conditioning var_types family rotation parameters df
#>     1    1        3, 1                    c,c    bb1       90       3, 2  2
#>     1    2        2, 1                    c,c    bb1       90       3, 2  2
#>     2    1        3, 2            1       c,c    bb1       90       3, 2  2
#>   tau
#>  -0.8
#>  -0.8
#>  -0.8

## vinecop objects
u <- sapply(1:3, function(i) runif(50))
vc <- vinecop(u, family = "par")
summary(vc)
#> # A data.frame: 3 x 11 
#>  tree edge conditioned conditioning var_types family rotation parameters df tau
#>     1    1        1, 2                    c,c  indep        0             0   0
#>     1    2        2, 3                    c,c  indep        0             0   0
#>     2    1        1, 3            2       c,c  indep        0             0   0
#>  loglik
#>       0
#>       0
#>       0

## vine_dist objects
vc <- vine_dist(list(distr = "norm"), pcs, mat)
summary(vc)
#> $margins
#> # A data.frame: 3 x 2 
#>  margin distr
#>       1  norm
#>       2  norm
#>       3  norm
#> 
#> $copula
#> # A data.frame: 3 x 10 
#>  tree edge conditioned conditioning var_types family rotation parameters df
#>     1    1        3, 1                    c,c    bb1       90       3, 2  2
#>     1    2        2, 1                    c,c    bb1       90       3, 2  2
#>     2    1        3, 2            1       c,c    bb1       90       3, 2  2
#>   tau
#>  -0.8
#>  -0.8
#>  -0.8
#> 

## vine objects
x <- sapply(1:3, function(i) rnorm(50))
vc <- vine(x, copula_controls = list(family_set = "par"))
summary(vc)
#> $margins
#> # A data.frame: 3 x 6 
#>  margin name nobs  bw loglik d.f.
#>       1   V1   50 1.1    -61  2.3
#>       2   V2   50 1.3    -69  2.6
#>       3   V3   50 1.2    -63  2.7
#> 
#> $copula
#> # A data.frame: 3 x 11 
#>  tree edge conditioned conditioning var_types family rotation parameters df
#>     1    1        1, 2                    c,c  indep        0             0
#>     1    2        2, 3                    c,c  frank        0        1.5  1
#>     2    1        1, 3            2       c,c    joe      270        1.1  1
#>     tau loglik
#>   0.000    0.0
#>   0.165    1.5
#>  -0.074    1.1
#>