MyNixOS website logo
Description

Stationary Vine Copula Models.

Provides functionality to fit and simulate from stationary vine copula models for time series, see Nagler et al. (2022) <doi:10.1016/j.jeconom.2021.11.015>.

R buildstatus Codecov testcoverage CRANstatus

An R package that provides functionality to fit and simulate from stationary vine copula models for time series.

The package is build on top of rvinecopulib and univariateML.

Installation

Install the development version from Github.

# install.packages("remotes")
remotes::install_github("tnagler/svines")

Usage

For detailed documentation and examples, see the API documentation.

library(svines)
#> Loading required package: rvinecopulib
data(returns)  # data set of stock returns
returns <- returns[1:500, 1:2]

Fitting models

fit <- svine(returns, p = 1)  # Markov order 1
#> Warning in f(x, na.rm = na.rm): The iteration limit (iterlim = 100) was reached
#> before the relative tolerance requirement (rel.tol = 0.0001220703125).

#> Warning in f(x, na.rm = na.rm): The iteration limit (iterlim = 100) was reached
#> before the relative tolerance requirement (rel.tol = 0.0001220703125).
summary(fit)
#> $margins
#> # A data.frame: 2 x 5 
#>  margin    name          model                         parameters loglik
#>       1 Allianz Skew Student-t 0.00039, 0.01589, 5.45533, 0.91785   1382
#>       2     AXA Skew Student-t 0.00052, 0.02089, 4.35198, 0.90611   1260
#> 
#> $copula
#> # A data.frame: 5 x 10 
#>  tree edge conditioned conditioning var_types family rotation   parameters df
#>     1    1        2, 1                    c,c      t        0   0.86, 3.48  2
#>     1    2        3, 2                    c,c      t        0 0.037, 4.893  2
#>     2    1        4, 2            3       c,c    joe       90          1.1  1
#>     2    2        3, 1            2       c,c  indep        0               0
#>     3    1        4, 1         2, 3       c,c      t        0 0.079, 8.994  2
#>     tau
#>   0.662
#>   0.023
#>  -0.033
#>   0.000
#>   0.051
contour(fit$copula)

Simulation

svine_sim() can be used in two different ways:

Generate a new time series of length 500

sim <- svine_sim(n = 500, rep = 1, model = fit)
pairs(sim)
pairs(returns)

Sample conditionally on the past given the past

sim <- svine_sim(n = 1, rep = 100, model = fit, past = returns)
pairs(t(sim[1, , ]))

Standard errors

To generate new bootstrapped models from the asymptotic distribution, use

models <- svine_bootstrap_models(2, fit)
summary(models[[1]])
#> $margins
#> # A data.frame: 2 x 5 
#>  margin    name          model                          parameters loglik
#>       1 Allianz Skew Student-t -0.00048, 0.01754, 3.87548, 0.86223     NA
#>       2     AXA Skew Student-t  3.3e-05, 2.2e-02, 3.5e+00, 8.5e-01     NA
#> 
#> $copula
#> # A data.frame: 5 x 10 
#>  tree edge conditioned conditioning var_types family rotation   parameters df
#>     1    1        2, 1                    c,c      t        0   0.89, 3.60  2
#>     1    2        3, 2                    c,c      t        0 0.037, 4.364  2
#>     2    1        4, 2            3       c,c    joe       90          1.1  1
#>     2    2        3, 1            2       c,c  indep        0               0
#>     3    1        4, 1         2, 3       c,c      t        0  0.04, 15.17  2
#>     tau
#>   0.694
#>   0.024
#>  -0.070
#>   0.000
#>   0.025
summary(models[[1]])
#> $margins
#> # A data.frame: 2 x 5 
#>  margin    name          model                          parameters loglik
#>       1 Allianz Skew Student-t -0.00048, 0.01754, 3.87548, 0.86223     NA
#>       2     AXA Skew Student-t  3.3e-05, 2.2e-02, 3.5e+00, 8.5e-01     NA
#> 
#> $copula
#> # A data.frame: 5 x 10 
#>  tree edge conditioned conditioning var_types family rotation   parameters df
#>     1    1        2, 1                    c,c      t        0   0.89, 3.60  2
#>     1    2        3, 2                    c,c      t        0 0.037, 4.364  2
#>     2    1        4, 2            3       c,c    joe       90          1.1  1
#>     2    2        3, 1            2       c,c  indep        0               0
#>     3    1        4, 1         2, 3       c,c      t        0  0.04, 15.17  2
#>     tau
#>   0.694
#>   0.024
#>  -0.070
#>   0.000
#>   0.025

References

Nagler, T., Krüger, D., Min, A. (2022). Stationary vine copula models for multivariate time series. Journal of Econometrics, 227(2), pp. 305-324[pdf][doi]

Metadata

Version

0.2.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows