We first load the data and calculate log-returns.
data(bitcoin)
<- (diff(log(bitcoin))[-1]) * 100 # log-returns (as percentages)
X length(X)
#> [1] 1043
plot(X, type = "h")
We start with the fulcrum profile-likelihood plot which indicates that a value \(\delta = 0.45\) is about right.
<- strank(X)
U
<- armacopula(pars = list(ar = 0.95, ma = -0.85))
copmod_Gauss <- seq(from=0.01, to=0.99, length=51) + 0.005
pts profilefulcrum(U, copmod_Gauss, locations = pts)
abline(v = 0.45)
Our baseline model is a model with ARMA(1,1) copula and v-transform with fulcrum at \(\delta=0.45\).
<- vtscopula(copmod_Gauss, Vlinear(0.45))
mod_Gauss <- fit(mod_Gauss, U, tsoptions = tsoptions)
fit_Gauss
fit_Gauss#> object class: vtscopula
#> ____________
#> Base copula:
#> object class: armacopula
#> name: ARMA(1,1)
#> parameters:
#> ar1 ma1
#> 0.9631285 -0.8424401
#> ____________
#> V-transform:
#> name: Vlinear
#> parameters:
#> delta
#> 0.45
#> _____________________
#> Summary of estimates:
#> ar.ar1 ma.ma1
#> par 0.96312845 -0.84244010
#> se 0.01146705 0.02698389
#> convergence status: 0, log-likelihood: 91.87754
In this next section we try a d-vine copula model of the second kind
with a finite value for maxlag
and a linear v-transform. We
continue to use the Frank copula. The resulting model is superior to the
ARMA copula model and has the same number of parameters. Note that an
infinite value for maxlag
makes next to no difference in
the fit.
<- dvinecopula2(family = "frank",
copmod_Frank pars = list(ar = 0.95, ma = -0.85),
maxlag = 30)
<- vtscopula(copmod_Frank, Vlinear(0.45))
mod_Frank <- fit(mod_Frank, U, tsoptions = tsoptions)
fit_Frank
AIC(fit_Gauss, fit_Frank)
#> df AIC
#> fit_Gauss 2 -179.7551
#> fit_Frank 2 -186.4793
We provide plots for the model with Frank copula to show aspects of the fit.
plot(fit_Frank, plottype = "residual")
plot(fit_Frank, plottype = "kendall")
We fit 6 marginal distributions (3 symmetric and 3 skewed) of which the double Weibull gives the lowest AIC value.
<- fit(margin("st"), X)
marg_st <- fit(margin("sst"), X)
marg_sst <- fit(margin("laplace",
marg_lp pars = c(mu = 0.2, scale = 2.7)), X)
<- fit(margin("slaplace",
marg_slp pars = c(mu = 0.2, scale = 2.7, gamma = 0.9)), X)
<- fit(margin("doubleweibull",
marg_dw pars = c(mu = 0.2, shape = 0.8, scale = 2.7)), X)
<- fit(margin("sdoubleweibull",
marg_sdw pars = c(mu = 0.2, shape = 0.8, scale = 2.7, gamma = 0.9)), X)
AIC(marg_st, marg_sst, marg_slp, marg_lp, marg_dw, marg_sdw)
#> df AIC
#> marg_st 3 5816.288
#> marg_sst 4 5818.249
#> marg_slp 3 5801.355
#> marg_lp 2 5799.447
#> marg_dw 3 5749.362
#> marg_sdw 4 5751.137
We fit a full model combining the double Weibull margin with the VT-d-vine model of the second kind.
<- tscm(fit_Frank, margin = marg_dw)
fullmod <- fit(fullmod, as.numeric(X),
fullmod method = "full", tsoptions = tsoptions)
fullmod#> object class: tscmfit
#> _______
#> MARGIN:
#> name: doubleweibull
#> parameters:
#> mu shape scale
#> 0.1916831 0.8440735 2.6642372
#> _______
#> COPULA:
#> object class: vtscopula
#> ____________
#> Base copula:
#> object class: dvinecopula2
#> name: type2-d-vine
#> copula family: frank
#> KPACF: kpacf_arma with max lag 30
#> parameters:
#> ar ma
#> 0.9597057 -0.8344572
#> ____________
#> V-transform:
#> name: Vlinear
#> parameters:
#> delta
#> 0.45
#> _________________________
#> summary of all estimates:
#> ar ma margin.mu margin.shape margin.scale
#> par 0.95970567 -0.83445716 0.1916831037 0.84407354 2.6642372
#> se 0.01385987 0.02878664 0.0006240695 0.03193025 0.2641212
#> convergence status: 10 , log-likelihood: -2776.903
AIC(marg_dw, fullmod)
#> df AIC
#> marg_dw 3 5749.362
#> fullmod 5 5563.807
We show all the possible plots for the full model.
plot(fullmod, plottype = "residual")
plot(fullmod, plottype = "kendall")
plot(fullmod, plottype = "margin")
plot(fullmod, plottype = "vtransform")
plot(fullmod, plottype = "volprofile")
plot(fullmod, plottype = "volproxy")
plot(fullmod, plottype = "glag")