Introduction

The two datasets used in this report were sourced from https://coinmarketcap.com/. The “Bitcoin_Historical_Price” dataset contains daily closing price of bitcoin from 27th of April 2013 to the 24th of February 2019. The “Bitcoin_Prices_Forecasts” dataset contains daily closing price of bitcoin from 27th of April 2013 to the 24th of February 2019. The aim of the investigation is to find the best model from a set of possible models for “Bitcoin_Historical_Price” dataset and make predictions for the next 10 days. To answer this question, the time series was first analysed through visualization. A set of ARIMA models was identified using ACF and PACF plots, the extended autocorrelation function (EACF) and Bayesian Information Criterion (BIC). Residuals from these ARIMA models showed changing variance, which suggested the use of ARMAxGARCH models.

The GARCH orders were identified based on the analysis of ARIMA residuals using ACF and PACF plots and the extended autocorrelation function (EACF). Absolute values of the residuals were used in process. Eventually a set of candidate ARMAxGARCH models was proposed for this data set. This process was further followed by estimating the model parameters and testing their significance. Diagnostic checks were made to test the goodness of fit of estimated models. Diagnostic checks included analysis of residuals from the fitted models and analysis of over fitted models. The best model was then selected and was used for forecasting.

Finally, forecast MASE and fit MASE were calculated to see how good the model is in future prediction and describing past data. Daily price produced in forecasting from proposed final model will be compared to actual price of bitcoin provided in the “Bitcoin_Prices_Forecasts” dataset to give MASE score for forecast. MASE score for model fitting will be obtained by comparing the actual and modeled daily closing price of bitcoin from 27th of April 2013 to the 24th of February 2019.

Load data

bitcoin.data<- read.csv("Bitcoin_Historical_Price.csv",header = T)
class(bitcoin.data)
## [1] "data.frame"
bitcoin.data$Close<- as.numeric(as.character(gsub(",","",bitcoin.data$Close)))
bitcoin<- ts(as.vector(bitcoin.data$Close), start = c(2013, as.numeric(format(as.Date("2013-04-27"), "%j"))), frequency = 365.25)
class(bitcoin)
## [1] "ts"
real <- read_csv("Bitcoin_Prices_Forecasts.csv")
## Parsed with column specification:
## cols(
##   Date = col_character(),
##   `Closing price` = col_double()
## )

Checking the class of bitcoin.data object showed that the data was read as a data frame, so it was converted to a time series bitcoin.

Data exploration and visualization

plot(bitcoin,type="o", main='Time series of daily bitcoin price', ylab='Daily bitcoin closing price')
*Figure 1 - Time series plots of daily bitcoin price*

Figure 1 - Time series plots of daily bitcoin price

Figure 1 shows that this time series plot has a general upward trend with no obvious seasonality or intervention point. There is obvious changing variance. Successive observations suggest autoregressive behavior. Fluctuation around mean level suggests moving average behavior.

plot(y=bitcoin, x=zlag(bitcoin), ylab='Daily closing price', xlab='Previous closing price',
     main='Daily bitcoin closing price vs previous closing price')
*Figure 2 - Daily bitcoin closing price vs previous closing price*

Figure 2 - Daily bitcoin closing price vs previous closing price

Figure 2 suggests strong positive correlation between daily closing price and previous year closing price. Increasing variance is also observed from this plot.

par(mfrow=c(1,2))
acf(bitcoin,lag.max = 700, main= "ACF plot of bitcoin")
pacf(bitcoin, lag.max = 700, main="PACF plot of bitcoin")
*Figure 3 - ACF and PACF plots of daily bitcoin price*

Figure 3 - ACF and PACF plots of daily bitcoin price

par(mfrow=c(1,1))

Form figure 3, a decaying pattern in ACF plot and the highly significant first lag in PACF suggest non-stationarity.

adf.test(bitcoin)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  bitcoin
## Dickey-Fuller = -2.6913, Lag order = 12, p-value = 0.2856
## alternative hypothesis: stationary

Augmented Dickey-Fuller Test gives a p-value of 0.2856, so we do not have enough evidence to reject null hypothesis of non-stationarity. This is consistent with our previous observation.

Data transformation

bitcoin.t = BoxCox.ar(bitcoin, method='yule-walker')

bitcoin.t$ci
## [1] 0 0
bitcoin.log = log(bitcoin)
qqnorm(bitcoin.log)
qqline(bitcoin.log, col = 2)

shapiro.test(bitcoin.log)
## 
##  Shapiro-Wilk normality test
## 
## data:  bitcoin.log
## W = 0.92816, p-value < 2.2e-16

BoxCox shows that lambda is 0 so we use log transformation. Normal qq plot shows that this transformation did not improve the normality of the series.

diff.bitcoin.t = diff(bitcoin.log ,differences = 1)
plot(diff.bitcoin.t,type='l', ylab='Daily bitcoin closing price', main = "Time Series plot of the first difference")
*Figure 4 - Time Series plot of the first differenced bitcoin*

Figure 4 - Time Series plot of the first differenced bitcoin

adf.test(diff.bitcoin.t)
## 
##  Augmented Dickey-Fuller Test
## 
## data:  diff.bitcoin.t
## Dickey-Fuller = -11.171, Lag order = 12, p-value = 0.01
## alternative hypothesis: stationary

Figure 4 shows no obvious trend in the time series plot after first differencing. Augmented Dickey-Fuller Test gives a p-value of 0.01, so we do not have enough evidence to reject null hypothesis of non-stationarity. This is consistent with our previous observation. The time series is now successfully detrended.

ARIMA model specification

par(mfrow=c(1,2))
acf(diff.bitcoin.t, main="ACF plot of transformed data")
pacf(diff.bitcoin.t, main="PACF plot of transformed data")
*Figure 5 - ACF and PACF plot of transformed data*

Figure 5 - ACF and PACF plot of transformed data

par(mfrow=c(1,1))
eacf(diff.bitcoin.t)
## AR/MA
##   0 1 2 3 4 5 6 7 8 9 10 11 12 13
## 0 o o o o x x o o o x x  o  o  o 
## 1 x o o o o x o o o o x  o  o  o 
## 2 o x o o o x o o o o x  o  o  o 
## 3 o x o o o x o o o o x  o  o  o 
## 4 x x o x o x o o o o x  o  o  o 
## 5 x x x x x o o o o o x  o  o  o 
## 6 x x x x x o o o o o o  o  o  o 
## 7 x x o x x x x o o o o  o  o  o
res = armasubsets(y=diff.bitcoin.t, nar=6, nma=6, y.name='test', ar.method='ols')
plot(res)
*Figure 6 - BIC table of transformed data*

Figure 6 - BIC table of transformed data

ARIMA modelling

Parameter estimation

Set of possible ARIMA models is {ARIMA(1,1,1), ARIMA(0,1,1), ARIMA(0,1,2), ARIMA(1,1,2), ARIMA(2,1,2), ARIMA(5,1,6), ARIMA(6,1,6)}

#Fit ARIMA(1,1,1)
model.111=arima(bitcoin.log, order = c(1,1,1), method='CSS')
coeftest(model.111)
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value Pr(>|z|)
## ar1 -0.075717   0.260272 -0.2909   0.7711
## ma1  0.081650   0.263542  0.3098   0.7567
model.111=arima(bitcoin.log, order = c(1,1,1), method='ML')
coeftest(model.111)
## Warning in sqrt(diag(se)): NaNs produced
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value Pr(>|z|)
## ar1 0.0021746         NA      NA       NA
## ma1 0.0023873         NA      NA       NA
  • CSS method shows that AR1 and MA1 coefficients of ARIMA(1,1,1) model are not statistically significant at 5% level.
  • ML method produces NA.
#Fit ARIMA(0,1,1)
model.011=arima(bitcoin.log, order = c(0,1,1), method='CSS')
coeftest(model.011)
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value Pr(>|z|)
## ma1 0.0046305  0.0220369  0.2101   0.8336
model.011=arima(bitcoin.log, order = c(0,1,1), method='ML')
coeftest(model.011)
## 
## z test of coefficients:
## 
##     Estimate Std. Error z value Pr(>|z|)
## ma1 0.004635   0.022047  0.2102   0.8335
  • CSS and ML methods both show that MA1 coefficient of ARIMA(0,1,1) model is not statistically significant at 5% level.
#Fit ARIMA(0,1,2)
model.012=arima(bitcoin.log, order = c(0,1,2), method='CSS')
coeftest(model.012)
## 
## z test of coefficients:
## 
##       Estimate Std. Error z value Pr(>|z|)
## ma1  0.0046336  0.0216804  0.2137   0.8308
## ma2 -0.0148010  0.0211223 -0.7007   0.4835
model.012=arima(bitcoin.log, order = c(0,1,2), method='ML')
coeftest(model.012)
## 
## z test of coefficients:
## 
##       Estimate Std. Error z value Pr(>|z|)
## ma1  0.0046479  0.0216884  0.2143   0.8303
## ma2 -0.0148141  0.0211285 -0.7011   0.4832
  • CSS and ML methods both show that all coefficients of ARIMA(0,1,2) model are not statistically significant at 5% level.
#Fit ARIMA(1,1,2)
model.112=arima(bitcoin.log, order = c(1,1,2), method='CSS')
coeftest(model.112)
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value Pr(>|z|)
## ar1 -0.077929   0.247528 -0.3148   0.7529
## ma1  0.082717   0.247621  0.3340   0.7383
## ma2 -0.011566   0.021253 -0.5442   0.5863
model.112=arima(bitcoin.log, order = c(1,1,2), method='ML')
coeftest(model.112)
## 
## z test of coefficients:
## 
##       Estimate Std. Error z value Pr(>|z|)
## ar1  0.0022707  0.6764819  0.0034   0.9973
## ma1  0.0023673  0.6760958  0.0035   0.9972
## ma2 -0.0148271  0.0211290 -0.7017   0.4828
  • CSS and ML methods both show that all coefficients of ARIMA(1,1,2) model are not statistically significant at 5% level.
# Fit ARIMA(2,1,2)
model.212=arima(bitcoin.log, order = c(2,1,2), method='CSS')
coeftest(model.212)
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value  Pr(>|z|)    
## ar1  0.964453   0.052087  18.516 < 2.2e-16 ***
## ar2 -0.820123   0.047772 -17.168 < 2.2e-16 ***
## ma1 -0.994856   0.053581 -18.567 < 2.2e-16 ***
## ma2  0.823164   0.049252  16.713 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model.212=arima(bitcoin.log, order = c(2,1,2), method='ML')
coeftest(model.212)
## Warning in sqrt(diag(se)): NaNs produced
## 
## z test of coefficients:
## 
##       Estimate Std. Error z value Pr(>|z|)
## ar1 -0.0097524         NA      NA       NA
## ar2 -0.1573077  0.1236355 -1.2724   0.2032
## ma1  0.0148331         NA      NA       NA
## ma2  0.1405875  0.1499990  0.9373   0.3486
  • CSS method shows that all coefficients in ARIMA(2,1,2) are statistically significant at 5% level.
  • ML method produces NA.
  • It can be included in the final candidate models.
#Fit ARIMA(5,1,6)
model.516=arima(bitcoin.log, order = c(5,1,6), method='CSS')
coeftest(model.516)
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value  Pr(>|z|)    
## ar1 -0.250360   0.107598 -2.3268   0.01998 *  
## ar2  0.444826   0.189709  2.3448   0.01904 *  
## ar3 -0.398113   0.077828 -5.1153 3.132e-07 ***
## ar4 -0.085168   0.118976 -0.7158   0.47409    
## ar5  0.581019   0.098896  5.8750 4.228e-09 ***
## ma1  0.245828   0.108768  2.2601   0.02381 *  
## ma2 -0.456099   0.194220 -2.3484   0.01886 *  
## ma3  0.392388   0.082941  4.7309 2.235e-06 ***
## ma4  0.141236   0.133919  1.0546   0.29159    
## ma5 -0.524782   0.101445 -5.1731 2.303e-07 ***
## ma6  0.054730   0.038124  1.4356   0.15112    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model.516=arima(bitcoin.log, order = c(5,1,6), method='ML')
coeftest(model.516)
## 
## z test of coefficients:
## 
##      Estimate Std. Error  z value  Pr(>|z|)    
## ar1 -0.121109   0.059491  -2.0358   0.04177 *  
## ar2  0.424659   0.064298   6.6046 3.987e-11 ***
## ar3 -0.525596   0.038567 -13.6280 < 2.2e-16 ***
## ar4  0.087580   0.047487   1.8443   0.06514 .  
## ar5  0.852950   0.051596  16.5314 < 2.2e-16 ***
## ma1  0.118401   0.062934   1.8814   0.05992 .  
## ma2 -0.429576   0.063944  -6.7180 1.843e-11 ***
## ma3  0.524964   0.043118  12.1750 < 2.2e-16 ***
## ma4 -0.047805   0.051001  -0.9373   0.34859    
## ma5 -0.818234   0.053421 -15.3166 < 2.2e-16 ***
## ma6  0.047342   0.026414   1.7923   0.07308 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  • CSS method shows that AR4, MA4 and MA6 coefficients of ARIMA(5,1,6) model are not statistically significant at 5% level.
  • ML method shows that AR4, MA1, MA4 and MA6 coefficients of ARIMA(5,1,6) model are not statistically significant at 5% level.
# Fit ARIMA(6,1,6)
model.616=arima(bitcoin.log, order = c(6,1,6), method='CSS')
coeftest(model.616)
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value  Pr(>|z|)    
## ar1 -0.335753   0.216210 -1.5529 0.1204466    
## ar2 -0.102417   0.168454 -0.6080 0.5431969    
## ar3  0.134972   0.149552  0.9025 0.3667866    
## ar4 -0.140161   0.108569 -1.2910 0.1967052    
## ar5  0.193837   0.134344  1.4428 0.1490659    
## ar6  0.441613   0.123689  3.5704 0.0003565 ***
## ma1  0.331001   0.224399  1.4751 0.1401979    
## ma2  0.088079   0.175442  0.5020 0.6156375    
## ma3 -0.132146   0.147344 -0.8969 0.3697984    
## ma4  0.180447   0.113207  1.5940 0.1109444    
## ma5 -0.119988   0.139784 -0.8584 0.3906800    
## ma6 -0.358845   0.121888 -2.9441 0.0032394 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model.616=arima(bitcoin.log, order = c(6,1,6), method='ML')
## Warning in stats::arima(x = x, order = order, seasonal = seasonal, xreg =
## xreg, : possible convergence problem: optim gave code = 1
coeftest(model.616)
## Warning in sqrt(diag(se)): NaNs produced
## 
## z test of coefficients:
## 
##      Estimate Std. Error z value Pr(>|z|)
## ar1 -0.222097         NA      NA       NA
## ar2 -0.274820         NA      NA       NA
## ar3  0.100349         NA      NA       NA
## ar4 -0.112641         NA      NA       NA
## ar5  0.495122         NA      NA       NA
## ar6  0.654811         NA      NA       NA
## ma1  0.223659         NA      NA       NA
## ma2  0.282402         NA      NA       NA
## ma3 -0.094607         NA      NA       NA
## ma4  0.132851         NA      NA       NA
## ma5 -0.441047         NA      NA       NA
## ma6 -0.595857         NA      NA       NA
  • CSS method shows that AR4, MA4 and MA6 coefficient of ARIMA(6,1,6) model are not statistically significant at 5% level.
  • Ml method produces NA.
# overfitted model ARIMA(5,1,7)
model.517=arima(bitcoin.log, order = c(5,1,7), method='CSS')
coeftest(model.517)
## 
## z test of coefficients:
## 
##       Estimate Std. Error z value  Pr(>|z|)    
## ar1 -0.2810942  0.1447388 -1.9421 0.0521275 .  
## ar2  0.3836947  0.2388397  1.6065 0.1081653    
## ar3 -0.4014160  0.0842962 -4.7620 1.917e-06 ***
## ar4 -0.0826142  0.1169251 -0.7066 0.4798418    
## ar5  0.5540236  0.1376927  4.0236 5.731e-05 ***
## ma1  0.2768468  0.1470141  1.8831 0.0596827 .  
## ma2 -0.3955915  0.2417941 -1.6361 0.1018254    
## ma3  0.3960094  0.0910375  4.3500 1.362e-05 ***
## ma4  0.1350030  0.1300284  1.0383 0.2991500    
## ma5 -0.4980632  0.1378115 -3.6141 0.0003014 ***
## ma6  0.0639775  0.0398882  1.6039 0.1087316    
## ma7  0.0048448  0.0287405  0.1686 0.8661353    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model.517=arima(bitcoin.log, order = c(5,1,7), method='ML')
## Warning in stats::arima(x = x, order = order, seasonal = seasonal, xreg =
## xreg, : possible convergence problem: optim gave code = 1
coeftest(model.517)
## Warning in sqrt(diag(se)): NaNs produced
## 
## z test of coefficients:
## 
##      Estimate Std. Error  z value  Pr(>|z|)    
## ar1 -0.144595         NA       NA        NA    
## ar2  0.426016   0.050339   8.4630 < 2.2e-16 ***
## ar3 -0.540637   0.033702 -16.0415 < 2.2e-16 ***
## ar4  0.076727   0.033341   2.3013   0.02138 *  
## ar5  0.853289   0.048361  17.6440 < 2.2e-16 ***
## ma1  0.143244   0.013749  10.4182 < 2.2e-16 ***
## ma2 -0.441227   0.055195  -7.9940 1.307e-15 ***
## ma3  0.538154   0.038231  14.0763 < 2.2e-16 ***
## ma4 -0.026936   0.042281  -0.6371   0.52407    
## ma5 -0.822595   0.054790 -15.0136 < 2.2e-16 ***
## ma6  0.047083   0.025722   1.8305   0.06718 .  
## ma7  0.018198   0.023822   0.7639   0.44492    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  • CSS method shows that AR1, AR2, AR4, MA4 and MA1, MA2, MA4, MA6, MA7 coefficients of ARIMA(5,1,7) model are not statistically significant at 5% level.
  • Ml method produces NA.
sort.score(AIC(model.111,model.011,model.012,model.112,model.212, model.516, model.616), score = "aic")
##           df       AIC
## model.516 12 -7332.099
## model.616 13 -7329.542
## model.011  2 -7299.666
## model.012  3 -7298.157
## model.111  3 -7297.666
## model.112  4 -7296.156
## model.212  5 -7294.316
  • Top models suggested from AIC scores are ARIMA(5,1,6), ARIMA(6,1,6)
  • Set of candidate ARIMA models is {ARIMA(5,1,6), ARIMA(6,1,6), ARIMA(2,1,2)}

Residual analysis

# Residual check ARIMA(5,1,6)
residual.analysis(model.516)
## Loading required package: lattice
## Loading required package: leaps
## Loading required package: ltsa
## Loading required package: bestglm
## 
## Attaching package: 'FitAR'
## The following object is masked from 'package:forecast':
## 
##     BoxCox
## 
##  Shapiro-Wilk normality test
## 
## data:  res.model
## W = 0.89292, p-value < 2.2e-16
*Figure 7 - residual analysis plot for ARIMA(5,1,6)*

Figure 7 - residual analysis plot for ARIMA(5,1,6)

According to Figure 7:

  • Time series plot of standardised residuals and qqplots suggests the existence of changing variance in the residuals.
  • Shapiro-Wilk normality test gives a p-value less than 0.05, there is enough evidence to reject null hypothesis of normality.
  • There is no significant lag in the ACF and PACF plots which suggests that the residuals of ARIMA(5,1,6)has no autocorrelation.
  • Ljung-Box test shows no lag with p-value less than 0.05, which suggests the absence of autocorrelation.
  • Residual ARIMA(5,1,6) will be used to find GARCH order later.
# Residual check ARIMA(6,1,6)
residual.analysis(model.616)
## 
##  Shapiro-Wilk normality test
## 
## data:  res.model
## W = 0.894, p-value < 2.2e-16
*Figure 8 - residual analysis plot for ARIMA(6,1,6)*

Figure 8 - residual analysis plot for ARIMA(6,1,6)

According to Figure 8:

  • Time series plot of standardized residuals and qqplots suggests the existence of changing variance in the residuals.
  • Shapiro-Wilk normality test gives a p-value less than 0.05, there is enough evidence to reject null hypothesis of normality.
  • There is no significant lag in the ACF and PACF plots which suggests that the residuals of ARIMA(6,1,6)has no autocorrelation.
  • Ljung-Box test shows no lag with p-value less than 0.05, which suggests the absence of autocorrelation.
  • Residual of ARIMA(6,1,6) will be used to find GARCH order later.
# Residual check for ARIMA(0,1,2)
residual.analysis(model.012)
## 
##  Shapiro-Wilk normality test
## 
## data:  res.model
## W = 0.88495, p-value < 2.2e-16
*Figure 9 - residual analysis plot for ARIMA(0,1,2)*

Figure 9 - residual analysis plot for ARIMA(0,1,2)

According to Figure 9:

  • Time series plot of standardized residuals and qqplots suggests the existence of changing variance in the residuals.
  • There is significant lags in pacf and acf plot which indicates the presence of autocorrelation in residuals.
  • Ljung-Box test shows many lags with p-values less than 0.05, which suggests autocorrelation as well.
  • Residuals of ARIMA(0,1,2) will not be used to find GARCH order later.

ARMA x GARCH modelling

Model specification

ARIMA(5,1,6) model

Figure 10 shows Time series plot of residuals ARIMA(5,1,6).

model.516_residuals=ts(model.516$residuals)
mean(model.516_residuals)
## [1] 0.001130279
plot(model.516_residuals, main='Time series plot of residuals ARIMA(5,1,6)')
*Figure 10 - Time series plot of residuals ARIMA(5,1,6)*

Figure 10 - Time series plot of residuals ARIMA(5,1,6)

Mean of residuals of ARIMA(5,1,6) model is close to 0. According to Figure 10, there is changing variance around mean 0.

Figure 11 shows Mcleod-li test statistics for daily bitcoin residuals series.

McLeod.Li.test(y=model.516_residuals, main="Mcleod-li test statistics for daily bitcoin residuals series")
*Figure 11 - Mcleod-li test statistics for daily bitcoin residuals series*

Figure 11 - Mcleod-li test statistics for daily bitcoin residuals series

According to Figure 11, McLeod.Li.test shows existence of changing variance.

Figure 12 shows the ACF and PACF plots for the residuals of ARIMA(5,1,6) model.

par(mfrow=c(1,2))
acf(model.516_residuals)
pacf(model.516_residuals)
*Figure 12 - ACF and PACF plots for the residuals of ARIMA(5,1,6) model*

Figure 12 - ACF and PACF plots for the residuals of ARIMA(5,1,6) model

par(mfrow=c(1,1))

From the ACF and PACF in Figure 12, we can observe white noise.

The following code displays EACF of the residuals of ARIMA(5,1,6) model:

eacf(model.516_residuals)
## AR/MA
##   0 1 2 3 4 5 6 7 8 9 10 11 12 13
## 0 o o o o o o o o o o o  o  o  o 
## 1 o o o o o o o o o o o  o  o  o 
## 2 x x o o o o o o o o o  o  o  o 
## 3 x x x o o o o o o o o  o  o  o 
## 4 x x x x o o o o o o o  o  o  o 
## 5 x x o x x o o o o o o  o  o  o 
## 6 x x o x x o o o o o o  o  o  o 
## 7 x x o x x o x o o o o  o  o  o

The vertex in EACF includes the values of p=0 and q=0 which suggests a white noise series.

As McLeod.Li.test shows existence of changing variance while the ACF, PACF and EACF all suggest white noise, then the absolute values are considered applying on the residuals of ARIMA(5,1,6) model.

Figure 13 shows the ACF and PACF plots for the absolute residuals of ARIMA(5,1,6) model.

abs.m516 = abs(model.516_residuals)
par(mfrow=c(1,2))
acf(abs.m516, lag.max = 50)
pacf(abs.m516, lag.max = 50)
*Figure 13 - ACF and PACF plots for the absolute residuals of ARIMA(5,1,6) model*

Figure 13 - ACF and PACF plots for the absolute residuals of ARIMA(5,1,6) model

par(mfrow=c(1,1))

From the ACF and PACF in Figure 13, we can observe a number of significant lags in both ACF and PACF with the effect of a highly volatile series for abosolute values.

The following code displays EACF of the absolute residuals of ARIMA(5,1,6) model:

eacf(abs.m516)
## AR/MA
##   0 1 2 3 4 5 6 7 8 9 10 11 12 13
## 0 x x x x x x x x x x x  x  x  x 
## 1 x x o o x o o o o x o  o  o  o 
## 2 x x o o o o o o o o o  o  o  o 
## 3 x x x o o o o o o o o  o  o  o 
## 4 x x x x o o o o o o o  o  o  o 
## 5 x x x x x o o o o o o  o  o  o 
## 6 x o x x x x o o o o o  o  o  o 
## 7 x x x x x x x o o o o  o  o  o

EACF gives a clearer picture. The vertex in EACF includes the values of p=1 and q=2. we can include models with p=2 and q=2. Correspondingly, the set of candidate GARCH models is {GARCH[max(1,2),1], GARCH[max(2,2),2]}, which give candidate ARMAxGARCH model is {ARMA(5,6)xGARCH(2,1), ARMA(5,6)xGARCH(2,2)}.

ARIMA(6,1,6) model

Figure 14 shows Time series plot of residuals ARIMA(6,1,6).

model.616_residuals=model.616$residuals
mean(model.616_residuals)
## [1] 0.00112241
plot(model.616_residuals, main='Time series plot of residuals ARIMA(6,1,6)')
*Figure 14 - Time series plot of residuals ARIMA(6,1,6)*

Figure 14 - Time series plot of residuals ARIMA(6,1,6)

Mean of residuals of ARIMA(6,1,6) model is close to 0. According to Figure 14, there is changing variance around mean 0.

Figure 15 shows Mcleod-li test statistics for daily bitcoin residuals series.

McLeod.Li.test(y=model.616_residuals, main="Mcleod-li test statistics for daily bitcoin residuals series")
*Figure 15 - Mcleod-li test statistics for daily bitcoin residuals series*

Figure 15 - Mcleod-li test statistics for daily bitcoin residuals series

According to Figure 15, McLeod.Li.test shows existence of changing variance.

Figure 16 shows the ACF and PACF plots for the residuals of ARIMA(6,1,6) model.

par(mfrow=c(1,2))
acf(model.616_residuals)
pacf(model.616_residuals)
*Figure 16 - ACF and PACF plots for the residuals of ARIMA(6,1,6) model*

Figure 16 - ACF and PACF plots for the residuals of ARIMA(6,1,6) model

par(mfrow=c(1,1))

From the ACF and PACF in Figure 16, we can observe white noise.

The following code displays EACF of the residuals of ARIMA(6,1,6) model:

eacf(model.616_residuals)
## AR/MA
##   0 1 2 3 4 5 6 7 8 9 10 11 12 13
## 0 o o o o o o o o o o o  o  o  o 
## 1 x o o o o o o o o o o  o  o  o 
## 2 x x o o o o o o o o o  o  o  o 
## 3 x x o o o o o o o o o  o  o  o 
## 4 x x x o o o o o o o o  o  o  o 
## 5 x x x x x o o o o o o  o  o  o 
## 6 x x x x x x o o o o o  o  o  o 
## 7 x x x x x x x o o o o  o  o  o

The vertex in EACF includes the values of p=0 and q=0 which suggests a white noise series.

As McLeod.Li.test shows existence of changing variance while the ACF, PACF and EACF all suggest white noise, then the absolute values are considered applying on the residuals of ARIMA(6,1,6) model.

Figure 17 shows the ACF and PACF plots for the absolute residuals of ARIMA(6,1,6) model.

abs.m616 = abs(model.616_residuals)
par(mfrow=c(1,2))
acf(abs.m616, lag.max = 50)
pacf(abs.m616, lag.max = 50)
*Figure 17 - ACF and PACF plots for the absolute residuals of ARIMA(6,1,6) model*

Figure 17 - ACF and PACF plots for the absolute residuals of ARIMA(6,1,6) model

par(mfrow=c(1,1))

From the ACF and PACF in Figure 17, we can observe a lot of significant lags in both ACF and PACF with the effect of a highly volatile series for abosolute values.

The following code displays EACF of the absolute residuals of ARIMA(6,1,6) model:

eacf(abs.m616)
## AR/MA
##   0 1 2 3 4 5 6 7 8 9 10 11 12 13
## 0 x x x x x x x x x x x  x  x  x 
## 1 x o o o x o o o o x o  o  x  o 
## 2 x x o o o o o o o o o  o  o  o 
## 3 x x x o o o o o o o o  o  o  o 
## 4 x x x x o o o o o o o  o  o  o 
## 5 x x x x x o o o o o o  o  o  o 
## 6 x o x x x x o o o o o  o  o  o 
## 7 x x x x x x x o o o o  o  o  o

EACF gives a clearer picture. The vertex in EACF includes the values of p=1 and q=1. we can include models with p=1; q=2 and p=2; q=2. Correspondingly, the set of candidate GARCH models is {GARCH[max(1,1),1], GARCH[max(1,2),1], GARCH[max(2,2),2]}, which give candidate ARMAxGARCH model is {ARMA(6,6)xGARCH(1,1), ARMA(6,6)xGARCH(2,1), ARMA(6,6)xGARCH(2,2)}.

Finally, the complete set of possible models for parameter estimation is: {ARMA(5,6)xGARCH(2,1), ARMA(5,6)xGARCH(2,2), ARMA(6,6)xGARCH(1,1), ARMA(6,6)xGARCH(2,1), ARMA(6,6)xGARCH(2,2)}.

Parameter estimation

Maximum likelihood estimation approaches will be used to fit the models from our candidate set.

ARMA(5,6)xGARCH(2,1) model

model.1 <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2, 1)), 
                      mean.model = list(armaOrder = c(5, 6), include.mean = FALSE), 
                      distribution.model = "norm")
m.56_21 <- ugarchfit(spec = model.1, data = diff.bitcoin.t, out.sample = 200)
m.56_21 
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(2,1)
## Mean Model   : ARFIMA(5,0,6)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error   t value Pr(>|t|)
## ar1     0.357408    0.039112    9.1381 0.000000
## ar2     0.925447    0.015610   59.2847 0.000000
## ar3    -0.913616    0.022417  -40.7551 0.000000
## ar4    -0.392257    0.051241   -7.6551 0.000000
## ar5     0.816433    0.030694   26.5995 0.000000
## ma1    -0.308839    0.035911   -8.6001 0.000000
## ma2    -0.955529    0.001213 -787.9698 0.000000
## ma3     0.882216    0.000942  936.3358 0.000000
## ma4     0.488777    0.044763   10.9193 0.000000
## ma5    -0.816211    0.029185  -27.9671 0.000000
## ma6    -0.037541    0.016536   -2.2703 0.023192
## omega   0.000026    0.000008    3.1492 0.001637
## alpha1  0.126065    0.021070    5.9831 0.000000
## alpha2  0.000000    0.030936    0.0000 1.000000
## beta1   0.872935    0.019781   44.1307 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## ar1     0.357408    0.045471    7.8600 0.000000
## ar2     0.925447    0.017756   52.1210 0.000000
## ar3    -0.913616    0.027976  -32.6570 0.000000
## ar4    -0.392257    0.075392   -5.2029 0.000000
## ar5     0.816433    0.040602   20.1081 0.000000
## ma1    -0.308839    0.043633   -7.0782 0.000000
## ma2    -0.955529    0.002491 -383.5604 0.000000
## ma3     0.882216    0.001637  538.9388 0.000000
## ma4     0.488777    0.067150    7.2789 0.000000
## ma5    -0.816211    0.038872  -20.9972 0.000000
## ma6    -0.037541    0.020583   -1.8239 0.068165
## omega   0.000026    0.000023    1.1265 0.259933
## alpha1  0.126065    0.032131    3.9235 0.000087
## alpha2  0.000000    0.064607    0.0000 1.000000
## beta1   0.872935    0.053315   16.3732 0.000000
## 
## LogLikelihood : 3598.567 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.7155
## Bayes        -3.6722
## Shibata      -3.7156
## Hannan-Quinn -3.6995
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                       1.346 2.460e-01
## Lag[2*(p+q)+(p+q)-1][32]    19.080 1.324e-05
## Lag[4*(p+q)+(p+q)-1][54]    27.882 4.423e-01
## d.o.f=11
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       3.313 0.06873
## Lag[2*(p+q)+(p+q)-1][8]      4.880 0.36937
## Lag[4*(p+q)+(p+q)-1][14]     7.560 0.43555
## d.o.f=3
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[4]     2.028 0.500 2.000  0.1545
## ARCH Lag[6]     2.266 1.461 1.711  0.4348
## ARCH Lag[8]     2.622 2.368 1.583  0.6164
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  3.1168
## Individual Statistics:              
## ar1    0.33389
## ar2    0.09142
## ar3    0.29353
## ar4    0.18347
## ar5    0.09300
## ma1    0.34833
## ma2    0.12153
## ma3    0.31426
## ma4    0.18747
## ma5    0.10900
## ma6    0.12259
## omega  0.19240
## alpha1 0.08202
## alpha2 0.06439
## beta1  0.11451
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          3.26 3.54 4.07
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           0.6499 0.5159    
## Negative Sign Bias  1.2076 0.2274    
## Positive Sign Bias  0.5007 0.6166    
## Joint Effect        1.7322 0.6298    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     260.7    2.108e-44
## 2    30     290.4    6.410e-45
## 3    40     313.9    1.163e-44
## 4    50     331.8    1.191e-43
## 
## 
## Elapsed time : 1.062431

Coefficient of alpha2 parameter is not significant at 5% level. The AIC criterion for ARMA(5,6)xGARCH(2,1) modle is -3.7155.

ARMA(5,6)xGARCH(2,2) model

model.2 <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2, 2)), 
                      mean.model = list(armaOrder = c(5, 6), include.mean = FALSE), 
                      distribution.model = "norm")
m.56_22 <- ugarchfit(spec = model.2, data = diff.bitcoin.t, out.sample = 200)
m.56_22 
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(2,2)
## Mean Model   : ARFIMA(5,0,6)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error    t value Pr(>|t|)
## ar1     0.335027    0.041660   8.041848 0.000000
## ar2     0.908612    0.036199  25.100348 0.000000
## ar3    -0.899900    0.010363 -86.836328 0.000000
## ar4    -0.386448    0.064898  -5.954672 0.000000
## ar5     0.803816    0.027666  29.054256 0.000000
## ma1    -0.287515    0.046468  -6.187440 0.000000
## ma2    -0.936432    0.041243 -22.705354 0.000000
## ma3     0.868472    0.002496 348.005780 0.000000
## ma4     0.482015    0.055315   8.713984 0.000000
## ma5    -0.802200    0.027158 -29.538053 0.000000
## ma6    -0.031966    0.017694  -1.806644 0.070818
## omega   0.000035    0.000011   3.269634 0.001077
## alpha1  0.186284    0.025102   7.420943 0.000000
## alpha2  0.000000    0.027674   0.000002 0.999999
## beta1   0.216896    0.080196   2.704576 0.006839
## beta2   0.595819    0.067953   8.768119 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## ar1     0.335027    0.091639   3.655944 0.000256
## ar2     0.908612    0.041872  21.699719 0.000000
## ar3    -0.899900    0.030845 -29.175015 0.000000
## ar4    -0.386448    0.135732  -2.847141 0.004411
## ar5     0.803816    0.136444   5.891196 0.000000
## ma1    -0.287515    0.079291  -3.626053 0.000288
## ma2    -0.936432    0.056722 -16.509290 0.000000
## ma3     0.868472    0.032793  26.483313 0.000000
## ma4     0.482015    0.120081   4.014088 0.000060
## ma5    -0.802200    0.123903  -6.474436 0.000000
## ma6    -0.031966    0.022869  -1.397799 0.162173
## omega   0.000035    0.000027   1.291863 0.196404
## alpha1  0.186284    0.040706   4.576297 0.000005
## alpha2  0.000000    0.047368   0.000001 0.999999
## beta1   0.216896    0.088585   2.448445 0.014347
## beta2   0.595819    0.062118   9.591673 0.000000
## 
## LogLikelihood : 3606.59 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.7227
## Bayes        -3.6766
## Shibata      -3.7229
## Hannan-Quinn -3.7058
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                       1.411 2.349e-01
## Lag[2*(p+q)+(p+q)-1][32]    19.613 2.588e-07
## Lag[4*(p+q)+(p+q)-1][54]    28.598 3.720e-01
## d.o.f=11
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       0.719  0.3965
## Lag[2*(p+q)+(p+q)-1][11]     3.361  0.8234
## Lag[4*(p+q)+(p+q)-1][19]     6.709  0.8117
## d.o.f=4
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[5] 3.896e-09 0.500 2.000  1.0000
## ARCH Lag[7] 3.065e-01 1.473 1.746  0.9467
## ARCH Lag[9] 1.514e+00 2.402 1.619  0.8495
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  2.5828
## Individual Statistics:              
## ar1    0.25400
## ar2    0.13911
## ar3    0.24487
## ar4    0.19270
## ar5    0.07485
## ma1    0.23310
## ma2    0.18702
## ma3    0.27398
## ma4    0.17337
## ma5    0.10848
## ma6    0.10833
## omega  0.18082
## alpha1 0.08384
## alpha2 0.08776
## beta1  0.10375
## beta2  0.11222
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          3.46 3.75 4.3
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           0.6555 0.5122    
## Negative Sign Bias  0.5691 0.5694    
## Positive Sign Bias  1.0176 0.3090    
## Joint Effect        1.3655 0.7137    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     263.3    6.270e-45
## 2    30     289.3    1.036e-44
## 3    40     296.3    2.755e-41
## 4    50     325.8    1.572e-42
## 
## 
## Elapsed time : 0.6831238

Coefficients of MA(6) and alpha2 parameters are not significant at 5% level. The AIC criterion for ARMA(5,6)xGARCH(2,2) modle is -3.7227.

ARMA(6,6)xGARCH(1,1) model

model.3 <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)), 
                      mean.model = list(armaOrder = c(6, 6), include.mean = FALSE), 
                      distribution.model = "norm")
m.66_11 <- ugarchfit(spec = model.3, data = diff.bitcoin.t, out.sample = 200)
m.66_11
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(1,1)
## Mean Model   : ARFIMA(6,0,6)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## ar1    -0.355135    0.074382  -4.7745 0.000002
## ar2    -0.354010    0.057657  -6.1399 0.000000
## ar3    -1.062696    0.060650 -17.5218 0.000000
## ar4    -0.412045    0.062964  -6.5442 0.000000
## ar5    -0.315320    0.062343  -5.0578 0.000000
## ar6    -0.752106    0.064122 -11.7293 0.000000
## ma1     0.374018    0.062830   5.9529 0.000000
## ma2     0.376576    0.048577   7.7521 0.000000
## ma3     1.075652    0.049153  21.8839 0.000000
## ma4     0.430839    0.049726   8.6642 0.000000
## ma5     0.337600    0.053601   6.2984 0.000000
## ma6     0.829979    0.050414  16.4634 0.000000
## omega   0.000026    0.000007   3.5318 0.000413
## alpha1  0.129502    0.015512   8.3485 0.000000
## beta1   0.869498    0.014235  61.0812 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error  t value Pr(>|t|)
## ar1    -0.355135    0.100832  -3.5221 0.000428
## ar2    -0.354010    0.060429  -5.8583 0.000000
## ar3    -1.062696    0.074858 -14.1962 0.000000
## ar4    -0.412045    0.085009  -4.8471 0.000001
## ar5    -0.315320    0.081915  -3.8493 0.000118
## ar6    -0.752106    0.085620  -8.7843 0.000000
## ma1     0.374018    0.088102   4.2453 0.000022
## ma2     0.376576    0.055580   6.7753 0.000000
## ma3     1.075652    0.063849  16.8468 0.000000
## ma4     0.430839    0.069637   6.1869 0.000000
## ma5     0.337600    0.075828   4.4522 0.000009
## ma6     0.829979    0.071207  11.6558 0.000000
## omega   0.000026    0.000020   1.3092 0.190452
## alpha1  0.129502    0.030728   4.2144 0.000025
## beta1   0.869498    0.033002  26.3466 0.000000
## 
## LogLikelihood : 3602.602 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.7196
## Bayes        -3.6764
## Shibata      -3.7198
## Hannan-Quinn -3.7037
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       5.288 0.02148
## Lag[2*(p+q)+(p+q)-1][35]    26.139 0.00000
## Lag[4*(p+q)+(p+q)-1][59]    35.575 0.08912
## d.o.f=12
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      2.725 0.09881
## Lag[2*(p+q)+(p+q)-1][5]     3.661 0.29950
## Lag[4*(p+q)+(p+q)-1][9]     4.784 0.46180
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]  0.005331 0.500 2.000  0.9418
## ARCH Lag[5]  1.764315 1.440 1.667  0.5257
## ARCH Lag[7]  2.190703 2.315 1.543  0.6770
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  2.4622
## Individual Statistics:              
## ar1    0.12128
## ar2    0.19598
## ar3    0.23097
## ar4    0.27567
## ar5    0.21290
## ar6    0.12431
## ma1    0.09940
## ma2    0.24228
## ma3    0.29828
## ma4    0.22599
## ma5    0.25447
## ma6    0.12710
## omega  0.19094
## alpha1 0.07803
## beta1  0.11212
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          3.26 3.54 4.07
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           0.3089 0.7574    
## Negative Sign Bias  0.9314 0.3518    
## Positive Sign Bias  0.4666 0.6408    
## Joint Effect        1.2558 0.7396    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     267.3    9.534e-46
## 2    30     271.0    4.218e-41
## 3    40     304.1    8.677e-43
## 4    50     330.3    2.272e-43
## 
## 
## Elapsed time : 0.7073121

Coefficients of all parameters are significant at 5% level. The AIC criterion for ARMA(6,6)xGARCH(1,1) modle is -3.7196.

ARMA(6,6)xGARCH(2,1) model

model.4 <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2, 1)), 
                      mean.model = list(armaOrder = c(6, 6), include.mean = FALSE), 
                      distribution.model = "norm")
m.66_21 <- ugarchfit(spec = model.4, data = diff.bitcoin.t, out.sample = 200)
m.66_21
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(2,1)
## Mean Model   : ARFIMA(6,0,6)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## ar1    -0.355201    0.076136  -4.6653 0.000003
## ar2    -0.354048    0.057660  -6.1402 0.000000
## ar3    -1.062681    0.062439 -17.0196 0.000000
## ar4    -0.412110    0.064032  -6.4360 0.000000
## ar5    -0.315340    0.062495  -5.0458 0.000000
## ar6    -0.752102    0.064701 -11.6243 0.000000
## ma1     0.374072    0.064407   5.8079 0.000000
## ma2     0.376609    0.048579   7.7525 0.000000
## ma3     1.075641    0.050503  21.2985 0.000000
## ma4     0.430882    0.050912   8.4632 0.000000
## ma5     0.337621    0.053763   6.2797 0.000000
## ma6     0.829982    0.050869  16.3162 0.000000
## omega   0.000026    0.000009   2.9394 0.003288
## alpha1  0.129522    0.021881   5.9195 0.000000
## alpha2  0.000000    0.033655   0.0000 1.000000
## beta1   0.869478    0.022416  38.7884 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error  t value Pr(>|t|)
## ar1    -0.355201    0.111562  -3.1839 0.001453
## ar2    -0.354048    0.060536  -5.8485 0.000000
## ar3    -1.062681    0.086616 -12.2689 0.000000
## ar4    -0.412110    0.091280  -4.5148 0.000006
## ar5    -0.315340    0.083596  -3.7722 0.000162
## ar6    -0.752102    0.088017  -8.5450 0.000000
## ma1     0.374072    0.097522   3.8358 0.000125
## ma2     0.376609    0.055454   6.7913 0.000000
## ma3     1.075641    0.071584  15.0262 0.000000
## ma4     0.430882    0.076026   5.6676 0.000000
## ma5     0.337621    0.077705   4.3449 0.000014
## ma6     0.829982    0.072134  11.5061 0.000000
## omega   0.000026    0.000026   1.0073 0.313782
## alpha1  0.129522    0.034399   3.7653 0.000166
## alpha2  0.000000    0.074003   0.0000 1.000000
## beta1   0.869478    0.061981  14.0281 0.000000
## 
## LogLikelihood : 3602.602 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.7186
## Bayes        -3.6725
## Shibata      -3.7187
## Hannan-Quinn -3.7016
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                        5.29 0.02145
## Lag[2*(p+q)+(p+q)-1][35]     26.14 0.00000
## Lag[4*(p+q)+(p+q)-1][59]     35.58 0.08905
## d.o.f=12
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       2.723 0.09891
## Lag[2*(p+q)+(p+q)-1][8]      4.406 0.44001
## Lag[4*(p+q)+(p+q)-1][14]     7.310 0.46636
## d.o.f=3
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[4]     2.197 0.500 2.000  0.1383
## ARCH Lag[6]     2.393 1.461 1.711  0.4102
## ARCH Lag[8]     2.836 2.368 1.583  0.5746
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  3.1772
## Individual Statistics:              
## ar1    0.12121
## ar2    0.19608
## ar3    0.23099
## ar4    0.27589
## ar5    0.21328
## ar6    0.12432
## ma1    0.09934
## ma2    0.24233
## ma3    0.29821
## ma4    0.22607
## ma5    0.25480
## ma6    0.12710
## omega  0.19097
## alpha1 0.07801
## alpha2 0.06424
## beta1  0.11214
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          3.46 3.75 4.3
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           0.3089 0.7574    
## Negative Sign Bias  0.9312 0.3519    
## Positive Sign Bias  0.4669 0.6406    
## Joint Effect        1.2557 0.7397    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     267.3    9.534e-46
## 2    30     271.1    3.988e-41
## 3    40     304.1    8.677e-43
## 4    50     329.0    3.963e-43
## 
## 
## Elapsed time : 0.956121

Coefficient of alpha2 parameter is not significant at 5% level. The AIC criterion for ARMA(6,6)xGARCH(2,1) modle is -3.7186.

ARMA(6,6)xGARCH(2,2) model

model.5 <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2, 2)), 
                      mean.model = list(armaOrder = c(6, 6), include.mean = FALSE), 
                      distribution.model = "norm")
m.66_22 <- ugarchfit(spec = model.5, data = diff.bitcoin.t, out.sample = 200)
m.66_22 
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(2,2)
## Mean Model   : ARFIMA(6,0,6)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error     t value Pr(>|t|)
## ar1    -1.526251    0.000166 -9.1880e+03 0.000000
## ar2    -0.917674    0.000108 -8.4848e+03 0.000000
## ar3    -0.423195    0.000065 -6.4851e+03 0.000000
## ar4    -1.052758    0.000122 -8.6038e+03 0.000000
## ar5    -1.370188    0.000152 -9.0152e+03 0.000000
## ar6    -0.527860    0.000070 -7.5266e+03 0.000000
## ma1     1.542715    0.000169  9.1059e+03 0.000000
## ma2     0.922881    0.000087  1.0581e+04 0.000000
## ma3     0.391258    0.000069  5.6883e+03 0.000000
## ma4     1.076429    0.000184  5.8658e+03 0.000000
## ma5     1.446693    0.000146  9.8898e+03 0.000000
## ma6     0.596417    0.000075  7.9553e+03 0.000000
## omega   0.000033    0.000011  3.1450e+00 0.001661
## alpha1  0.177462    0.025347  7.0013e+00 0.000000
## alpha2  0.001221    0.030146  4.0517e-02 0.967681
## beta1   0.258020    0.102828  2.5092e+00 0.012099
## beta2   0.562261    0.088388  6.3613e+00 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error     t value Pr(>|t|)
## ar1    -1.526251    0.001283 -1.1895e+03 0.000000
## ar2    -0.917674    0.000501 -1.8319e+03 0.000000
## ar3    -0.423195    0.000267 -1.5863e+03 0.000000
## ar4    -1.052758    0.000855 -1.2316e+03 0.000000
## ar5    -1.370188    0.001044 -1.3130e+03 0.000000
## ar6    -0.527860    0.000271 -1.9459e+03 0.000000
## ma1     1.542715    0.000394  3.9111e+03 0.000000
## ma2     0.922881    0.000073  1.2629e+04 0.000000
## ma3     0.391258    0.000225  1.7368e+03 0.000000
## ma4     1.076429    0.001066  1.0095e+03 0.000000
## ma5     1.446693    0.000516  2.8046e+03 0.000000
## ma6     0.596417    0.000314  1.9012e+03 0.000000
## omega   0.000033    0.000031  1.0816e+00 0.279446
## alpha1  0.177462    0.050595  3.5075e+00 0.000452
## alpha2  0.001221    0.061342  1.9912e-02 0.984114
## beta1   0.258020    0.115477  2.2344e+00 0.025458
## beta2   0.562261    0.078684  7.1458e+00 0.000000
## 
## LogLikelihood : 3608.295 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.7235
## Bayes        -3.6744
## Shibata      -3.7236
## Hannan-Quinn -3.7054
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                       5.215 0.0223916
## Lag[2*(p+q)+(p+q)-1][35]    35.126 0.0000000
## Lag[4*(p+q)+(p+q)-1][59]    45.862 0.0002987
## d.o.f=12
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                      0.5218  0.4701
## Lag[2*(p+q)+(p+q)-1][11]    2.9794  0.8711
## Lag[4*(p+q)+(p+q)-1][19]    5.9556  0.8772
## d.o.f=4
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[5]   0.02383 0.500 2.000  0.8773
## ARCH Lag[7]   0.29544 1.473 1.746  0.9493
## ARCH Lag[9]   1.47384 2.402 1.619  0.8566
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  9.2345
## Individual Statistics:              
## ar1    0.16608
## ar2    0.07376
## ar3    0.05580
## ar4    0.11947
## ar5    0.16468
## ar6    0.04355
## ma1    0.14016
## ma2    0.02805
## ma3    0.10637
## ma4    0.14706
## ma5    0.11622
## ma6    0.02841
## omega  0.16917
## alpha1 0.08140
## alpha2 0.10828
## beta1  0.10900
## beta2  0.11351
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          3.64 3.95 4.51
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           1.1342 0.2568    
## Negative Sign Bias  0.1964 0.8443    
## Positive Sign Bias  0.2012 0.8406    
## Joint Effect        2.2644 0.5194    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     248.4    6.438e-42
## 2    30     270.8    4.461e-41
## 3    40     286.0    2.421e-39
## 4    50     299.8    1.010e-37
## 
## 
## Elapsed time : 1.094225

Coefficient of alpha2 parameter is not significant at 5% level. The AIC criterion for ARMA(6,6)xGARCH(2,2) modle is -3.7235.

Residual analysis

We check the residuals for randomness, normality and independence (autocorrelation).

ARMA(5,6)xGARCH(2,1) model

par(mfrow=c(2,2))
plot(m.56_21, which=1)
plot(m.56_21, which=8)
plot(m.56_21, which=9)
plot(m.56_21, which=10)
*Figure 18 - Residuals plots for ARMA(5,6)xGARCH(2,1)*

Figure 18 - Residuals plots for ARMA(5,6)xGARCH(2,1)

par(mfrow=c(1,1))

Firstly, from looking at the time series plot of the returns, we can observe no obvious trend, the returns are smaller in the beginning but overall, seem randomly distributed. The hishtogram shows that residuals are slightly left-skewed distributed, which is confirmed by the Q-Q plot. This may be caused by the sudden increasing in price of bitcoin at the end of 2017. To check the independence, we consider the sample ACF of the residuals. There two slightly significant lags in the residuals from this model.This model is not suitable for forecasting.

ARMA(5,6)xGARCH(2,2) model

par(mfrow=c(2,2))
plot(m.56_22, which=1)
plot(m.56_22, which=8)
plot(m.56_22, which=9)
plot(m.56_22, which=10)
*Figure 19 - Residuals plots for ARMA(5,6)xGARCH(2,2)*

Figure 19 - Residuals plots for ARMA(5,6)xGARCH(2,2)

par(mfrow=c(1,1))

Firstly, from looking at the time series plot of the returns, we can observe no obvious trend, the returns are smaller in the beginning but overall, seem randomly distributed. The hishtogram shows that residuals are slightly left-skewed distributed, which is confirmed by the Q-Q plot. This may be caused by the sudden increasing in price of bitcoin at the end of 2017. To check the independence, we consider the sample ACF of the residuals. There seems to be no evidence of autocorrelation in the residuals from this model. This model is suitable for forecasting.

ARMA(6,6)xGARCH(1,1) model

par(mfrow=c(2,2))
plot(m.66_11, which=1)
plot(m.66_11, which=8)
plot(m.66_11, which=9)
plot(m.66_11, which=10)
*Figure 20 - Residuals plots for ARMA(6,6)xGARCH(1,1)*

Figure 20 - Residuals plots for ARMA(6,6)xGARCH(1,1)

par(mfrow=c(1,1))

Firstly, from looking at the time series plot of the returns, we can observe no obvious trend, the returns are smaller in the beginning but overall, seem randomly distributed. The hishtogram shows that residuals are slightly left-skewed distributed, which is confirmed by the Q-Q plot. This may be caused by the sudden increasing in price of bitcoin at the end of 2017. To check the independence, we consider the sample ACF of the residuals. The ACF shows the remaining autocorrelation in the residuals, significant lag at lag 1. This model is not suitable for forecasting.

ARMA(6,6)xGARCH(2,1) model

par(mfrow=c(2,2))
plot(m.66_21, which=1)
plot(m.66_21, which=8)
plot(m.66_21, which=9)
plot(m.66_21, which=10)
*Figure 21 - Residuals plots for ARMA(6,6)xGARCH(2,1)*

Figure 21 - Residuals plots for ARMA(6,6)xGARCH(2,1)

par(mfrow=c(1,1))

Firstly, from looking at the time series plot of the returns, we can observe no obvious trend, the returns are smaller in the beginning but overall, seem randomly distributed. The hishtogram shows that residuals are slightly left-skewed distributed, which is confirmed by the Q-Q plot. This may be caused by the sudden increasing in price of bitcoin at the end of 2017. To check the independence, we consider the sample ACF of the residuals. The ACF shows the remaining autocorrelation in the residuals, significant lag at lag 1. This model is not suitable for forecasting.

ARMA(6,6)xGARCH(2,2) model

par(mfrow=c(2,2))
plot(m.66_22, which=1)
plot(m.66_22, which=8)
plot(m.66_22, which=9)
plot(m.66_22, which=10)
*Figure 22 - Residuals plots for ARMA(6,6)xGARCH(2,2)*

Figure 22 - Residuals plots for ARMA(6,6)xGARCH(2,2)

par(mfrow=c(1,1))

Firstly, from looking at the time series plot of the returns, we can observe no obvious trend, the returns are smaller in the beginning but overall, seem randomly distributed. The hishtogram shows that residuals are slightly left-skewed distributed, which is confirmed by the Q-Q plot. This may be caused by the sudden increasing in price of bitcoin at the end of 2017. To check the independence, we consider the sample ACF of the residuals. The ACF shows the remaining autocorrelation in the residuals, significant lag at lag 1. This model is not suitable for forecasting.

Model selection

For model selection we will consider output of residual analysis and AIC criteria of the models to decide on the best among the set. As ARMA(5,6)xGARCH(2,2) model has the best result of the residual analysis and the smallest AIC criterion (-3.7227), it is considered as the best model among the set. So we will continue the analysis with this model.

Overfitting

ARMA(5,6)xGARCH(2,3)

We can use overfitting as another tool to detect anomalies in terms of goodness of fit. ARMA(5,6)xGARCH(2,3) model is adding an ARCH(1) component to our selected model ARMA(5,6)xGARCH(2,2).

model.6 <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2, 3)), 
                      mean.model = list(armaOrder = c(5, 6), include.mean = FALSE), 
                      distribution.model = "norm")
m.56_23 <- ugarchfit(spec = model.6, data = diff.bitcoin.t, out.sample = 200)
m.56_23
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(2,3)
## Mean Model   : ARFIMA(5,0,6)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error     t value Pr(>|t|)
## ar1    -0.182944    0.012860  -14.225440 0.000000
## ar2     0.388860    0.014561   26.705413 0.000000
## ar3    -0.547774    0.013560  -40.394872 0.000000
## ar4     0.129576    0.011811   10.970918 0.000000
## ar5     0.865561    0.012759   67.837596 0.000000
## ma1     0.215175    0.018038   11.929280 0.000000
## ma2    -0.374743    0.000669 -559.778142 0.000000
## ma3     0.539039    0.001361  396.197517 0.000000
## ma4    -0.095517    0.011971   -7.978799 0.000000
## ma5    -0.867259    0.001383 -626.980224 0.000000
## ma6     0.009499    0.016182    0.586999 0.557204
## omega   0.000037    0.000018    2.047455 0.040613
## alpha1  0.190147    0.024471    7.770278 0.000000
## alpha2  0.000001    0.098309    0.000005 0.999996
## beta1   0.198922    0.508468    0.391218 0.695636
## beta2   0.576143    0.113923    5.057323 0.000000
## beta3   0.033787    0.281921    0.119846 0.904605
## 
## Robust Standard Errors:
##         Estimate  Std. Error     t value Pr(>|t|)
## ar1    -0.182944    0.017045  -10.732837 0.000000
## ar2     0.388860    0.017270   22.516878 0.000000
## ar3    -0.547774    0.015766  -34.742949 0.000000
## ar4     0.129576    0.015047    8.611689 0.000000
## ar5     0.865561    0.018459   46.890373 0.000000
## ma1     0.215175    0.024690    8.715099 0.000000
## ma2    -0.374743    0.001660 -225.765038 0.000000
## ma3     0.539039    0.001641  328.444876 0.000000
## ma4    -0.095517    0.011332   -8.428970 0.000000
## ma5    -0.867259    0.001813 -478.396028 0.000000
## ma6     0.009499    0.021123    0.449677 0.652943
## omega   0.000037    0.000017    2.149091 0.031627
## alpha1  0.190147    0.043574    4.363820 0.000013
## alpha2  0.000001    0.075884    0.000007 0.999995
## beta1   0.198922    0.458488    0.433864 0.664387
## beta2   0.576143    0.138090    4.172230 0.000030
## beta3   0.033787    0.276939    0.122002 0.902897
## 
## LogLikelihood : 3608.438 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.7236
## Bayes        -3.6746
## Shibata      -3.7238
## Hannan-Quinn -3.7056
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic   p-value
## Lag[1]                        2.55 1.103e-01
## Lag[2*(p+q)+(p+q)-1][32]     20.69 1.748e-11
## Lag[4*(p+q)+(p+q)-1][54]     28.21 4.098e-01
## d.o.f=11
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                      0.4434  0.5055
## Lag[2*(p+q)+(p+q)-1][14]    4.0992  0.8707
## Lag[4*(p+q)+(p+q)-1][24]    7.8988  0.8806
## d.o.f=5
## 
## Weighted ARCH LM Tests
## ------------------------------------
##              Statistic Shape Scale P-Value
## ARCH Lag[6]     0.1341 0.500 2.000  0.7142
## ARCH Lag[8]     0.2789 1.480 1.774  0.9550
## ARCH Lag[10]    3.4955 2.424 1.650  0.4949
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  4.2893
## Individual Statistics:              
## ar1    0.05928
## ar2    0.36007
## ar3    0.19826
## ar4    0.05678
## ar5    0.13603
## ma1    0.06804
## ma2    0.39575
## ma3    0.20499
## ma4    0.08775
## ma5    0.18322
## ma6    0.12168
## omega  0.18177
## alpha1 0.07048
## alpha2 0.10145
## beta1  0.10035
## beta2  0.10483
## beta3  0.09319
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          3.64 3.95 4.51
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           0.1352 0.8925    
## Negative Sign Bias  0.2559 0.7981    
## Positive Sign Bias  0.5270 0.5983    
## Joint Effect        0.7460 0.8623    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     253.1    7.450e-43
## 2    30     284.7    8.586e-44
## 3    40     280.6    2.529e-38
## 4    50     311.4    7.535e-40
## 
## 
## Elapsed time : 0.7708511

Coefficients of MA(6), alpha2, beta1 and beta3 parameters are not significant at 5% level. The AIC criterion for ARMA(5,6)xGARCH(2,3) modle is -3.7227, which is the same as the AIC criterion for the initial model. These points support ARMA(5,6)xGARCH(2,2)) as a suitable model for forecasting.

ARMA(5,6)xGARCH(3,2)

Another model to test is ARMA(5,6)xGARCH(3,2) which adds an GARCH(1) component to our selected model ARMA(5,6)xGARCH(2,2).

model.7 <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(3, 2)), 
                      mean.model = list(armaOrder = c(5, 6), include.mean = FALSE), 
                      distribution.model = "norm")
m.56_32 <- ugarchfit(spec = model.7, data = diff.bitcoin.t, out.sample = 200)
m.56_32
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : sGARCH(3,2)
## Mean Model   : ARFIMA(5,0,6)
## Distribution : norm 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error    t value Pr(>|t|)
## ar1    -0.558928    0.032022 -17.454430 0.000000
## ar2     0.114899    0.030936   3.714102 0.000204
## ar3    -0.099796    0.032776  -3.044787 0.002328
## ar4     0.590758    0.035493  16.644230 0.000000
## ar5     0.889177    0.041211  21.576134 0.000000
## ma1     0.585526    0.037520  15.605772 0.000000
## ma2    -0.094129    0.038629  -2.436709 0.014822
## ma3     0.090018    0.033241   2.708011 0.006769
## ma4    -0.588652    0.037260 -15.798495 0.000000
## ma5    -0.909240    0.035025 -25.959967 0.000000
## ma6     0.012534    0.020545   0.610062 0.541821
## omega   0.000039    0.000016   2.413769 0.015788
## alpha1  0.194591    0.031085   6.259917 0.000000
## alpha2  0.000000    0.030125   0.000002 0.999998
## alpha3  0.000000    0.045970   0.000000 1.000000
## beta1   0.232611    0.091641   2.538285 0.011140
## beta2   0.571798    0.082324   6.945713 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## ar1    -0.558928    0.037591 -14.868811 0.000000
## ar2     0.114899    0.033998   3.379622 0.000726
## ar3    -0.099796    0.044717  -2.231745 0.025632
## ar4     0.590758    0.053527  11.036582 0.000000
## ar5     0.889177    0.074843  11.880577 0.000000
## ma1     0.585526    0.048398  12.098151 0.000000
## ma2    -0.094129    0.054621  -1.723309 0.084833
## ma3     0.090018    0.042515   2.117338 0.034231
## ma4    -0.588652    0.055635 -10.580521 0.000000
## ma5    -0.909240    0.054602 -16.652249 0.000000
## ma6     0.012534    0.025440   0.492688 0.622233
## omega   0.000039    0.000054   0.726921 0.467275
## alpha1  0.194591    0.053536   3.634753 0.000278
## alpha2  0.000000    0.056496   0.000001 0.999999
## alpha3  0.000000    0.127363   0.000000 1.000000
## beta1   0.232611    0.111799   2.080629 0.037468
## beta2   0.571798    0.092109   6.207866 0.000000
## 
## LogLikelihood : 3604.525 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -3.7196
## Bayes        -3.6705
## Shibata      -3.7197
## Hannan-Quinn -3.7015
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic  p-value
## Lag[1]                       4.448 0.034934
## Lag[2*(p+q)+(p+q)-1][32]    27.831 0.000000
## Lag[4*(p+q)+(p+q)-1][54]    38.665 0.004527
## d.o.f=11
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                      0.4218  0.5160
## Lag[2*(p+q)+(p+q)-1][14]    4.6101  0.8161
## Lag[4*(p+q)+(p+q)-1][24]    8.4946  0.8380
## d.o.f=5
## 
## Weighted ARCH LM Tests
## ------------------------------------
##              Statistic Shape Scale P-Value
## ARCH Lag[6]     0.1481 0.500 2.000  0.7004
## ARCH Lag[8]     0.5067 1.480 1.774  0.8990
## ARCH Lag[10]    4.3543 2.424 1.650  0.3638
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  3.572
## Individual Statistics:              
## ar1    0.27174
## ar2    0.22153
## ar3    0.38879
## ar4    0.09002
## ar5    0.27007
## ma1    0.32573
## ma2    0.34007
## ma3    0.26719
## ma4    0.17179
## ma5    0.29591
## ma6    0.08615
## omega  0.19563
## alpha1 0.07530
## alpha2 0.10224
## alpha3 0.06340
## beta1  0.10650
## beta2  0.11126
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          3.64 3.95 4.51
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value   prob sig
## Sign Bias           0.3115 0.7555    
## Negative Sign Bias  0.1267 0.8992    
## Positive Sign Bias  0.5986 0.5495    
## Joint Effect        1.0662 0.7852    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     254.4    4.010e-43
## 2    30     275.2    6.261e-42
## 3    40     298.7    9.600e-42
## 4    50     308.2    2.886e-39
## 
## 
## Elapsed time : 0.9075279

Coefficients of MA(6), alpha2, beta1 and beta3 parameters are not significant at 5% level. The AIC criterion for ARMA(5,6)xGARCH(2,3) model is -3.7236, which slightly smaller the AIC criterion for the initial model. These points support ARMA(5,6)xGARCH(2,2)) as a suitable model for forecasting.

Forecasting

Figure 23 shows the plots of forecasts generated with chosen ARMA(5,6)xGARCH(2,2) model. The forecasts for the series are shown on Forecast Series plot. From the plot Rolling Forecast vs Actual Series it is observed that the model is good at capturing most of the movement in the series, especially toward the end. The forecast of unconditional variance suggests that the variance will fluctuate but increase over time.

forc.56_22 = ugarchforecast(m.56_22, data = diff.bitcoin.t, n.ahead = 10, n.roll = 10)
plot(forc.56_22, which = "all")
*Figure 23 - Forecasting with ARMA(5,6)xGARCH(2,2)*

Figure 23 - Forecasting with ARMA(5,6)xGARCH(2,2)

forc.56_22
## 
## *------------------------------------*
## *       GARCH Model Forecast         *
## *------------------------------------*
## Model: sGARCH
## Horizon: 10
## Roll Steps: 10
## Out of Sample: 10
## 
## 0-roll forecast [T0=1975-04-14 10:00:00]:
##          Series   Sigma
## T+1  -0.0069931 0.04297
## T+2  -0.0019093 0.03711
## T+3   0.0046599 0.04112
## T+4  -0.0059731 0.03922
## T+5   0.0043574 0.04078
## T+6  -0.0109649 0.04028
## T+7   0.0023253 0.04099
## T+8  -0.0070509 0.04098
## T+9   0.0031327 0.04140
## T+10  0.0002903 0.04156

Forecasts of actual prices for the next 10 days are: 3783.876, 3776.659, 3794.299, 3771.703, 3788.173, 3746.863, 3755.586 3729.199, 3740.899, 3741.985

Mean Absolute Scaled Error calculation

MASE was calculated for our best model ARMA(5,6)xGARCH(2,2) to measure its accuracy over the forecasts and fitted values.

forecasts <- forc.56_22@forecast$seriesFor[,1]
forecasts <- diffinv(forecasts, differences = 1, xi = log(3810.43))
forecasts <- exp(forecasts)
mase.for <- MASE(real$`Closing price`, forecasts[-1])
model.final <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2, 2)), 
                          mean.model = list(armaOrder = c(5, 6), include.mean = FALSE), distribution.model = "norm")
m.fit <- ugarchfit(spec = model.final, data = diff.bitcoin.t)
fitted.values <- fitted(m.fit)
fitted.values <- as.vector(fitted.values)
fitted.values <- diffinv(fitted.values, differences = 1, xi = log(134.21))
fitted.values <- exp(fitted.values)
mase.fit <- MASE(bitcoin,fitted.values)

The following table displays the value of MASE over fitted values and over forecasts for our selected model ARMA(5,6)xGARCH(2,2):

##                      Best MASE
## 1 Over fitted values 27.176088
## 2     Over forecasts  2.935458

Conclusion

This report focused on analysing daily closing price of bitcoin from the 27th of April 2013 to the 24th of February 2019. The final goal was to find a suitable model to predict closing price of bitcoin for the next 10 days. The process included descriptive analysis, data visualization, model specification, model fitting and selection, followed by diagnostic checking. ARIMA modelling was followed by GARCH modelling because of the discovered changing variance effect in the series.

The results of this reseasrch showed that ARMA(5,6)xGARCH(2,2) was a suitable model for forecasting upon residual analysis and overparameterization. The forecasts with the chosen model indicate that the unconditional variance of closing price will be increasing over time.

Finally, a mean absolute scaled error metric was calculated over the fitted values and the forecasts to evaluate the accuracy of ARMA(5,6)xGARCH(2,2) model. MASE over the fitted values was 27.18 and 2.93 over the forecasts.