We generate a Gaussian ARMA model.
set.seed(13)
<- 0.5 + 2*arima.sim(list(ar =0.95, ma =-0.85), 1000)
data1 ts.plot(data1)
A model spec can be fitted to data with the generic command
fit
.
<- armacopula(pars = list(ar =0.01, ma =0.01))
copspec <- margin("norm")
margspec <- tscm(copspec, margspec)
fullspec <- fit(fullspec, data1, method = "full")
modfit
modfit#> object class: tscmfit
#> _______
#> MARGIN:
#> name: norm
#> parameters:
#> mean sd
#> 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.mean margin.sd
#> 0.9380637 -0.8255022 0.5845416 2.1558708
#> convergence status: 0 , log-likelihood: -2135.118
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")
<- dvinecopula2(family = "joe",
copmod kpacf = "kpacf_arma",
pars = list(ar = 0.9, ma = -0.8),
maxlag = 20)
<- vtscopula(copmod,
vcopmod Vtransform = V2p(delta = 0.5, kappa = 2))
<- margin("slaplace",
margmod pars = c(mu = 1, scale = 2, gamma = 0.7))
<- tscm(vcopmod, margmod)
tscmmod
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:
#> ar ma
#> 0.9 -0.8
#> ____________
#> V-transform:
#> name: V2p
#> parameters:
#> delta kappa
#> 0.5 2.0
set.seed(13)
<- sim(tscmmod, n= 2000)
data2 hist(data2)
ts.plot(data2)
First fit a marginal model only.
<- fit(margmod, data2) margfit
Now fit the time series copula model stepwise.
<- fit(tscmmod, data2)
tscmfit_step
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:
#> ar ma
#> 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)
#> ar ma delta kappa mu scale gamma
#> 0.9045782 -0.7980417 0.5000000 1.9894803 1.0136622 2.0855250 0.7108397
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.
<- fit(tscmfit_step, data2, method = "full")
tscmfit_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:
#> ar ma
#> 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
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")