Basic Time Series Copula Processes

This library currently implements 3 basic kinds of time series copula process: ARMA copula processes and d-vine copula processes of type 1 and type 2. These are described in the next 3 sections.

1. ARMA Copula Processes

AR(1) Example

An ARMA copula is specified by a list of two vectors, the first named ar and the second ma. The following example creates an AR(1) copula process specification and then displays the spec.

ar1 <- armacopula(list(ar = 0.7))
ar1
#> object class: armacopula
#> name: ARMA(1,0)
#> parameters: 
#> ar1 
#> 0.7

A realization can be generated with the generic command sim.

set.seed(13)
data1 <- sim(ar1, 1000)
ts.plot(data1)

A model specification can be fitted to data with the generic command fit.

ar1spec <- armacopula(list(ar = 0))
ar1fit <- fit(ar1spec, data1)
ar1fit
#> object class: armacopula
#> name: ARMA(1,0)
#> _____________________
#> Summary of estimates:
#>       ar1 
#> 0.7048399 
#> convergence status: 0, log-likelihood: 354.6794

ARMA(1,1) Example

The next example simulates and fits an ARMA(1,1) copula process, giving standard errors for the parameter estimates.

arma11 <- armacopula(list(ar = 0.95, ma = -0.85))
data2 <- sim(arma11, 1000)
ts.plot(data2)

arma11spec <- armacopula(list(ar = 0.1, ma = 0.1))
arma11fit <- fit(arma11spec, data2, tsoptions = list(hessian = TRUE))
arma11fit
#> object class: armacopula
#> name: ARMA(1,1)
#> _____________________
#> Summary of estimates:
#>            ar1         ma1
#> par 0.95688150 -0.86695448
#> se  0.01631116  0.02724842
#> convergence status: 0, log-likelihood: 35.81021

Coefficients of the fitted model are obtained with the command coef, residuals with the command resid and various plots are generated by the generic command plot.

coef(arma11fit)
#>        ar1        ma1 
#>  0.9568815 -0.8669545
res <- resid(arma11fit)
acf(res)
acf(abs(res))
plot(arma11fit)
plot(arma11fit, plottype = "kendall")
mu_t <- resid(arma11fit, trace = TRUE)
ts.plot(mu_t)

The data for these plots come from applying the Kalman filter command kfilter.

head(kfilter(arma11fit@tscopula, data2))
#>            mu_t   sigma_t       resid
#> [1,]  0.0000000 1.0000000 -2.03983043
#> [2,] -0.3381019 0.9861678 -0.81202147
#> [3,] -0.4399684 0.9771623 -0.98922161
#> [4,] -0.5479523 0.9710454 -0.09981730
#> [5,] -0.5360906 0.9667704  1.16242677
#> [6,] -0.3846082 0.9637228  0.06419146

2. D-Vine Copula Processes (AR type)

Construction

We construct a copula of order \(p = 3\) in which the copulas are respectively Clayton, Frank, and Gauss. The parameters are given in a list. Individual copulas can be rotated through 180 degrees.

copmod <- sdvinecopula(
  pars = list(ar=c(0.7, -0.4, 0.15)),
  family = c("Clayton","Frank", "Gaussian"),
  posrot = c(180,0, 0)
)
copmod
#> object class: sdvinecopula
#> name: stationary d-vine
#> kpacf: kpacf_arma
#> 3 explicit copula substitutions:
#>  - families: clayton180 frank gaussian0 
#>  - maximum lag is 3 
#> parameters: 
#>   ar1   ar2   ar3 
#>  0.70 -0.40  0.15

Simulation

A realization can be generated with the generic command sim.

set.seed(29)
data1 <- sim(copmod, n = 2000)
hist(data1)
ts.plot(data1)

Estimation

A model spec can be fitted to data with the generic command fit.

copspec <- sdvinecopula(
  pars = list(ar = rep(0,3)),
  family = c("Clayton","Frank", "Gaussian"),
  posrot = c(180, 0, 0)
)
copfit <- fit(copspec, data1, 
              tsoptions = list(hessian = TRUE),
              control = list(maxit = 2000))
copfit
#> object class: sdvinecopula
#> name: stationary d-vine
#> kpacf: kpacf_arma
#> 3 explicit copula substitutions:
#>  - families: clayton180 frank gaussian0 
#>  - maximum lag is 3 
#> _____________________
#> Summary of estimates:
#>            ar1         ar2        ar3
#> par 0.65485787 -0.36444737 0.14613825
#> se  0.01849327  0.02406385 0.02070514
#> convergence status: 0, log-likelihood: 420.0936
coef(copfit)
#>        ar1        ar2        ar3 
#>  0.6548579 -0.3644474  0.1461382
coef(copmod)
#>   ar1   ar2   ar3 
#>  0.70 -0.40  0.15

Plotting

Various plots are generated by the generic command plot.

plot(copfit)
plot(copfit, plottype = "kendall")

Here is the generalized lag plot.

plot(copfit, plottype = "glag")

3. D-Vine Copula Processes (ARMA type)

Construction

We construct a model using the Joe copula and the Kendall partial autocorrelation function (KPACF) of a Gaussian ARMA process with autogressive (ar) parameter 0.9 and moving average (ma) parameter -0.85. The KPACF is truncated at lag 20, so this is a process of finite order. We can also set \(\text{maxlag} = \inf\) but this leads to much slower simulation.

copmod <- sdvinecopula(pars = list(ar = 0.9, ma = -0.85),
                       kpacf = "kpacf_arma",
                       basefamily = "joe",
                       maxlag = 20)
copmod
#> object class: sdvinecopula
#> name: stationary d-vine
#> kpacf: kpacf_arma
#> base family: joe 
#>  - positive and negative rotations: 0 0 
#>  - maximum lag is 20 
#> parameters: 
#>    ar    ma 
#>  0.90 -0.85

Simulation

A realization can be generated with the generic command sim.

set.seed(13)
data1 <- sim(copmod, n = 2000)
hist(data1)
ts.plot(data1)

Estimation

A model spec can be fitted to data with the generic command fit.

copspec_Gauss <- sdvinecopula(pars = list(ar = 0, ma = 0),
                              maxlag = 20)
fitGauss <- fit(copspec_Gauss, data1)
fitGauss
#> object class: sdvinecopula
#> name: stationary d-vine
#> kpacf: kpacf_arma
#> base family: gauss 
#>  - maximum lag is 20 
#> _____________________
#> Summary of estimates:
#>         ar         ma 
#>  0.9234119 -0.8695245 
#> convergence status: 10, log-likelihood: 21.26753

copspec_Joe <- sdvinecopula(pars = list(ar = 0, ma = 0),
                       kpacf = "kpacf_arma",
                       basefamily = "joe",
                       maxlag = 20)
fitJoe <- fit(copspec_Joe, data1)
fitJoe
#> object class: sdvinecopula
#> name: stationary d-vine
#> kpacf: kpacf_arma
#> base family: joe 
#>  - positive and negative rotations: 0 0 
#>  - maximum lag is 20 
#> _____________________
#> Summary of estimates:
#>         ar         ma 
#> -0.7770185  0.8536074 
#> convergence status: 0, log-likelihood: 48.98484

AIC(fitGauss, fitJoe)
#>          df       AIC
#> fitGauss  2 -38.53506
#> fitJoe    2 -93.96967

Plotting

Various plots are generated by the generic command plot.

plot(fitJoe)
plot(fitJoe, plottype = "kendall")