Models with Margins

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 (ARMA type) with Skewed Laplace Margin

Construction

copmod <- sdvinecopula(basefamily = "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: 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.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.0949524 2.0237699 0.6761895 
#> _______
#> COPULA: 
#> object class: vtscopula
#> ____________ 
#> Base copula: 
#> 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.9051608 -0.7960986 
#> ____________ 
#> V-transform: 
#> name: V2p
#> parameters: 
#>    delta    kappa 
#> 0.500000 2.383484 
#> _________________________
#> summary of all estimates:
#>           ar           ma     vt.kappa    margin.mu margin.scale margin.gamma 
#>    0.9051608   -0.7960986    2.3834841    1.0949524    2.0237699    0.6761895 
#> convergence status: 0 , log-likelihood: -4794.001
coef(tscmfit_step)
#>         ar         ma      delta      kappa         mu      scale      gamma 
#>  0.9051608 -0.7960986  0.5000000  2.3834841  1.0949524  2.0237699  0.6761895
coef(tscmmod)
#>    ar    ma 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.0949047 1.9908152 0.6811999 
#> _______
#> COPULA: 
#> object class: vtscopula
#> ____________ 
#> Base copula: 
#> 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.9035789 -0.7964695 
#> ____________ 
#> V-transform: 
#> name: V2p
#> parameters: 
#>    delta    kappa 
#> 0.500000 2.319719 
#> _________________________
#> summary of all estimates:
#>           ar           ma     vt.kappa    margin.mu margin.scale margin.gamma 
#>    0.9035789   -0.7964695    2.3197187    1.0949047    1.9908152    0.6811999 
#> convergence status: 0 , log-likelihood: -4793.906

Comparison of model.

AIC(margfit, tscmfit_step, tscmfit_full)
#>              df      AIC
#> margfit       3 9896.496
#> tscmfit_step  6 9600.002
#> tscmfit_full  6 9599.811

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")