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.
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.7A realization can be generated with the generic command
sim.
A model specification can be fitted to data with the generic command
fit.
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.81021Coefficients 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.06419146We 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.15A realization can be generated with the generic command
sim.
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.15We 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.85A realization can be generated with the generic command
sim.
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