The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Models with Margins

Alexander J. McNeil and Martin Bladt

2024-02-16

1. Gaussian ARMA Process

Construction

We generate a Gaussian ARMA model.

set.seed(13)
data1 <- 0.5 + 2*arima.sim(list(ar =0.95, ma =-0.85), 1000)
ts.plot(data1)

Estimation

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

copspec <- armacopula(pars = list(ar =0.01, ma =0.01))
margspec <- margin("norm")
fullspec <- tscm(copspec, margspec)
modfit <- fit(fullspec, data1, method = "full")
modfit
#> object class: tscmfit
#> _______ 
#> MARGIN: 
#> name: gauss
#> parameters: 
#>        mu     sigma 
#> 0.5845416 2.1558708 
#> _______
#> COPULA: 
#> object class: armacopula
#> name: ARMA(1,1)
#> parameters: 
#>        ar1        ma1 
#>  0.9380637 -0.8255022 
#> _________________________
#> summary of all estimates:
#>       ar.ar1       ma.ma1    margin.mu margin.sigma 
#>    0.9380637   -0.8255022    0.5845416    2.1558708 
#> convergence status: 0 , log-likelihood: -2135.118

Plotting

As well as the copula plots we can also plot the marginal fit.

plot(modfit, plottype = "residual")
plot(modfit, plottype = "kendall")
plot(modfit, plottype = "margin")

2. VT-D-Vine Process (type 2) with Skewed Laplace Margin

Construction

copmod <- dvinecopula2(family = "joe",
                       kpacf = "kpacf_arma",
                       pars = list(ar = 0.9, ma = -0.8),
                       maxlag = 20)
vcopmod <- vtscopula(copmod,
                     Vtransform = V2p(delta = 0.5, kappa = 2))
margmod <- margin("slaplace",
                  pars = c(mu = 1, scale = 2, gamma = 0.7))
tscmmod <- tscm(vcopmod, margmod)
tscmmod
#> object class: tscm
#> _______ 
#> MARGIN: 
#> name: slaplace
#> parameters: 
#>    mu scale gamma 
#>   1.0   2.0   0.7 
#> _______
#> COPULA: 
#> object class: vtscopula
#> ____________ 
#> Base copula: 
#> object class: dvinecopula2
#> name: type2-d-vine
#> copula family: joe
#> KPACF: kpacf_arma with max lag 20
#> parameters: 
#> [1]  0.9 -0.8
#> ____________ 
#> V-transform: 
#> name: V2p
#> parameters: 
#> delta kappa 
#>   0.5   2.0

Simulation

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

Estimation

First fit a marginal model only.

margfit <- fit(margmod, data2)

Now fit the time series copula model stepwise.

tscmfit_step <- fit(tscmmod, data2)
tscmfit_step
#> object class: tscmfit
#> _______ 
#> MARGIN: 
#> name: slaplace
#> parameters: 
#>        mu     scale     gamma 
#> 1.0136622 2.0855250 0.7108397 
#> _______
#> COPULA: 
#> object class: vtscopula
#> ____________ 
#> Base copula: 
#> object class: dvinecopula2
#> name: type2-d-vine
#> copula family: joe
#> KPACF: kpacf_arma with max lag 20
#> parameters: 
#> [1]  0.9045782 -0.7980417
#> ____________ 
#> V-transform: 
#> name: V2p
#> parameters: 
#>   delta   kappa 
#> 0.50000 1.98948 
#> _________________________
#> summary of all estimates:
#>           ar           ma     vt.kappa    margin.mu margin.scale margin.gamma 
#>    0.9045782   -0.7980417    1.9894803    1.0136622    2.0855250    0.7108397 
#> convergence status: 0 , log-likelihood: -4819.964
coef(tscmfit_step)
#>                            delta      kappa         mu      scale      gamma 
#>  0.9045782 -0.7980417  0.5000000  1.9894803  1.0136622  2.0855250  0.7108397
coef(tscmmod)
#>             delta kappa    mu scale gamma 
#>   0.9  -0.8   0.5   2.0   1.0   2.0   0.7

Final optimization over all parameters.

tscmfit_full <- fit(tscmfit_step, data2, method = "full")
tscmfit_full
#> object class: tscmfit
#> _______ 
#> MARGIN: 
#> name: slaplace
#> parameters: 
#>        mu     scale     gamma 
#> 1.0132969 2.0839697 0.7119104 
#> _______
#> COPULA: 
#> object class: vtscopula
#> ____________ 
#> Base copula: 
#> object class: dvinecopula2
#> name: type2-d-vine
#> copula family: joe
#> KPACF: kpacf_arma with max lag 20
#> parameters: 
#> [1]  0.9043820 -0.7981071
#> ____________ 
#> V-transform: 
#> name: V2p
#> parameters: 
#>    delta    kappa 
#> 0.500000 1.979627 
#> _________________________
#> summary of all estimates:
#>           ar           ma     vt.kappa    margin.mu margin.scale margin.gamma 
#>    0.9043820   -0.7981071    1.9796267    1.0132969    2.0839697    0.7119104 
#> convergence status: 0 , log-likelihood: -4819.961

Comparison of model.

AIC(margfit, tscmfit_step, tscmfit_full)
#>              df      AIC
#> margfit       3 9947.347
#> tscmfit_step  6 9651.929
#> tscmfit_full  6 9651.921

Plotting

We can plot the estimated v-transform and well as the goodness-of-fit plots for the dvinecopula object based on Kendall rank correlations.

The first plots relate to the fitted copula.

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

The next plot is the QQplot of the marginal fit.

plot(tscmfit_full, plottype = "margin")

The next two plots are the estimated v-transform and the estimated volatility profile function.

plot(tscmfit_full, plottype = "vtransform")
plot(tscmfit_full, plottype = "volprofile")

The final plot shows aspect of the fit of the v-transform to the data.

plot(tscmfit_full, plottype = "volproxy")

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.