The data set of this assignment is gathered from coinmarketcap.com which includes the daily closing price of bitcoin from 27th of April 2013 to the 3rd of March 2018.
The main purpose of this assignment is to analyse the data by using time series analysis methods and accurately predict the value of bitcoin for the next 10 days.
#score sort function to sort the scores of both AIC and BIC
sort.score <- function(x, score = c("bic", "aic")){
if (score == "aic"){
x[with(x, order(AIC)),]
} else if (score == "bic") {
x[with(x, order(BIC)),]
} else {
warning('score = "x" only accepts valid arguments ("aic","bic")')
}
}
MASE = function(observed , fitted ){
# observed: Observed series on the forecast period
# fitted: Forecast values by your model
Y.t = observed
n = length(fitted)
e.t = Y.t - fitted
sum = 0
for (i in 2:n){
sum = sum + abs(Y.t[i] - Y.t[i-1] )
}
q.t = e.t / (sum/(n-1))
MASE = data.frame( MASE = mean(abs(q.t)))
return(list(MASE = MASE))
}
residual.analysis <- function(model, std = TRUE,start = 2, class = c("ARIMA","GARCH","ARMA-GARCH")[1]){
if (class == "ARIMA"){
if (std == TRUE){
res.model = rstandard(model)
}else{
res.model = residuals(model)
}
}else if (class == "GARCH"){
res.model = model$residuals[start:model$n.used]
}else if (class == "ARMA-GARCH"){
res.model = model@fit$residuals
}else {
stop("The argument 'class' must be either 'ARIMA' or 'GARCH' ")
}
res.model = na.remove(res.model)
par(mfrow=c(3,2))
plot(res.model,type='o',ylab='Standardised residuals', main="Time series plot of standardised residuals")
abline(h=0)
hist(res.model,main="Histogram of standardised residuals")
acf(res.model,main="ACF of standardised residuals")
pacf(res.model,main="PACF of standardised residuals")
qqnorm(res.model,main="QQ plot of standardised residuals")
qqline(res.model, col = 2)
print(shapiro.test(res.model))
k=0
LBQPlot(res.model, lag.max = 30, StartLag = k + 1, k = 0, SquaredQ = FALSE)
}
Loading the data set of daily closing price of bitcoin from 27th of April 2013 to the 3rd of March 2018 we see that the value of bitcoin varies from $68.43 to $19,497.40.
bitcoin <- read.csv("Bitcoin_Historical_Price.csv")
bitcoin$Date <- as.Date(bitcoin$Date)
bitcoin.ts <- ts(bitcoin$Close, start = c(2013, as.numeric(difftime(bitcoin$Date[1], "2013-01-01"))), frequency = 365)
#bitcoin.ts = ts(bitcoin$Close)
summary(bitcoin.ts)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 68.43 276.00 490.42 1547.36 893.65 19497.40
plot(bitcoin.ts, xlab="Year", ylab="Price", main="Bitcoin Historical Price" )
There are multiple trends in the series and lots of periods volatility is quite high. and this implies in existence of ARCH effect.
We can observe fluctuating successive point implying a moving average characteristic and also succeeding observations that imply existence of auto-regressive nature in the trend.
But there is no strong obvious seasonality because at some parts its very low and few parts have very high trends .So we will display ACF and PACF plots to confirm the existence of the trend.
ACF and PACF of Bitcoin price series:
acf(bitcoin.ts, main="ACF for Bitcoin Price series.")
Slowly decaying pattern in ACF.We observe the expected exponential decay in the ACF plot of this series. So, AR(1) has auto-correlation at lags 1, 2, 3, and so on.
pacf(bitcoin.ts,main="PACF for Bitcoin Price series.")
There is a very high first correlation in PACF which implies the existence of trend and it is nonstationarity. We will consider converting the series to a return series and apply GARCH models.
trans = log(bitcoin.ts)
plot(trans,ylab='First Difference of CO2',xlab='Time',main = "Time Series Plot of the
First Differences of Carbon Dioxide Levels")
After applying log transformation the non-stationarity seems to be removed. But the log of series adjusts for change in variance but the trend still exists. Hence, we applied differencing of order 1 to the log series to calculate returns of Bitcoin price to removes the trend.
#Applying first difference
bitcoin_diff1 = diff(trans)*100
But the returns series shows lot of fluctuating points, volatility is obvious,there is no sense of trend or seasonality and hence suggesting heteroskedasticity.
par(mfrow=c(1,2))
acf(bitcoin_diff1)
pacf(bitcoin_diff1)
ACF: In ACF and PACF it’s not just white noise, but we have few very high significant lags in ACF.There is a very high first correlation in PACF.
eacf(bitcoin_diff1)
## 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 x x o o o x o o o o x o o o
## 3 x x x 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 o x x x o o o o o o o o
## 7 x x o x x x x o o o o o o o
Considering EACF, it is suggestion 0. Although there are some significant correlations in ACF and PACF, EACF table supports ARMA(0,0) model. Due to this we look at McLeod-Li test.
McLeod.Li.test(y= bitcoin_diff1, main = "McLeod Li test")
The MacLeod-Li tests are highly significant and normality assumption is highly violated
qqnorm(bitcoin_diff1, main = "Q-Q plot")
qqline(bitcoin_diff1, col="red")
QQ normal plot has thick tails on both left and right side. Considering observations of both McLeod-Li test and QQ normal plot it indicates that it’s a ARCH GARCH model
adfTest(bitcoin_diff1, lags = 0, title = NULL,description = NULL)
## Warning in adfTest(bitcoin_diff1, lags = 0, title = NULL, description =
## NULL): p-value smaller than printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 0
## STATISTIC:
## Dickey-Fuller: -41.6891
## P VALUE:
## 0.01
##
## Description:
## Mon Jun 24 16:25:43 2019 by user: Vikrant
p-value is 0.01 and hence we stop at diff=1 in order to avoid over fitting. For the specification of the orders of GARCH model, we are using squared and absolute value series of the returns.
abs.bitcoin.diff1 = abs(bitcoin_diff1)
sq.bitcoin.diff1 = bitcoin_diff1^2
ACF and PACF for absolute value of our series can be seen below.
par(mfrow = c(1,2))
acf(abs.bitcoin.diff1, ci.type="ma", main="sample ACF for series")
pacf(abs.bitcoin.diff1, main="The sample PACF plot for series")
It can be observed that, We have a lot of significant correlation in both ACF and PACF with the effects of highly volatile series for absolute value series.
eacf(abs.bitcoin.diff1)
## 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 x x x o o o x o o o o
## 2 x x o o o o o o o x o o o o
## 3 x x x o o o o o o x o o o o
## 4 x x x x o o o o o x 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 o o o o o o o o o
## 7 x o x x x x x x o o o o o o
EACF gives a clear picture of auto correlation structure. Now, ACF and PACF for square transformation values are analysed.
par(mfrow=c(1,2))
acf(sq.bitcoin.diff1, ci.type="ma",main="The sample ACF plot for series")
pacf(sq.bitcoin.diff1, main="The sample PACF plot for series")
It is visible that there are a lot of significant correlation in both ACF and PACF with the effects of highly volatile series for square values of series which is similar as ACF and PACF of absolute value series.
eacf(sq.bitcoin.diff1)
## 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 x x x x o x o x o o x o
## 2 x x o o o x o o o x o o x o
## 3 x x x o o x o o o x o o x o
## 4 x x x o o o o o o o o o x o
## 5 x x x o x x 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 o x x x x o o o o o o
We have a lot of significant correlations in both ACF and PACF with the effect of highly volatile series for both squared and absolute value series.
EACF gives a clearer picture the we can identify the value of as 1 and max(p,q) as 2 over the absolute value series.
For the squared series, we have the same inference for the values of p is 2 and max(p,q) 3.
So, the set of possible models are,
Following is to fit these models and check their residuals violations of assumptions.
m.11 = garch(bitcoin_diff1, order = c(1,1), trace = FALSE,na.action = na.pass)
## Warning in sqrt(pred$e): NaNs produced
summary(m.11)
##
## Call:
## garch(x = bitcoin_diff1, order = c(1, 1), trace = FALSE, na.action = na.pass)
##
## Model:
## GARCH(1,1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.56014 -0.33632 0.06798 0.53328 4.76681
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## a0 0.361737 0.038019 9.515 <2e-16 ***
## a1 0.148416 0.009537 15.562 <2e-16 ***
## b1 0.852360 0.007003 121.722 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Diagnostic Tests:
## Jarque Bera Test
##
## data: Residuals
## X-squared = 5695.3, df = 2, p-value < 2.2e-16
##
##
## Box-Ljung test
##
## data: Squared.Residuals
## X-squared = 0.65512, df = 1, p-value = 0.4183
GARCH(1,1) in which all the coefficients are significant, normality is quite bad and has no problem with auto correlation.
m.12 = garch(bitcoin_diff1, order = c(1,2), trace = FALSE)
summary(m.12)
##
## Call:
## garch(x = bitcoin_diff1, order = c(1, 2), trace = FALSE)
##
## Model:
## GARCH(1,2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.11936 -0.26571 0.04728 0.43127 5.73071
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## a0 1.720e+01 1.321e+00 13.023 < 2e-16 ***
## a1 1.509e-01 1.561e-02 9.669 < 2e-16 ***
## a2 1.099e-01 2.365e-02 4.645 3.39e-06 ***
## b1 4.705e-13 6.290e-02 0.000 1
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Diagnostic Tests:
## Jarque Bera Test
##
## data: Residuals
## X-squared = 2740.7, df = 2, p-value < 2.2e-16
##
##
## Box-Ljung test
##
## data: Squared.Residuals
## X-squared = 8.0899, df = 1, p-value = 0.004451
GARCH(1,2) in which all the coefficients are significant, normality is also quite bad and has no problem with auto correlation.
m.22 = garch(bitcoin_diff1, order = c(2,2), trace = FALSE)
summary(m.22)
##
## Call:
## garch(x = bitcoin_diff1, order = c(2, 2), trace = FALSE)
##
## Model:
## GARCH(2,2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.24961 -0.26953 0.04809 0.44019 5.76487
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## a0 1.619e+01 1.322e+00 12.249 < 2e-16 ***
## a1 1.538e-01 1.525e-02 10.084 < 2e-16 ***
## a2 1.125e-01 2.701e-02 4.165 3.11e-05 ***
## b1 2.788e-13 1.150e-01 0.000 1.000
## b2 7.301e-03 5.967e-02 0.122 0.903
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Diagnostic Tests:
## Jarque Bera Test
##
## data: Residuals
## X-squared = 2757.7, df = 2, p-value < 2.2e-16
##
##
## Box-Ljung test
##
## data: Squared.Residuals
## X-squared = 6.9254, df = 1, p-value = 0.008498
GARCH(2,2) in which coefficients has 2 insignificants, normality is quite bad and has no problem with auto correlation.But seems like its over fitted.
m.33 = garch(bitcoin_diff1, order = c(3,3), trace = FALSE)
summary(m.33)
##
## Call:
## garch(x = bitcoin_diff1, order = c(3, 3), trace = FALSE)
##
## Model:
## GARCH(3,3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.39993 -0.28378 0.04976 0.45570 5.98383
##
## Coefficient(s):
## Estimate Std. Error t value Pr(>|t|)
## a0 1.417e+01 2.235e+00 6.338 2.32e-10 ***
## a1 1.449e-01 1.388e-02 10.442 < 2e-16 ***
## a2 9.861e-02 3.178e-02 3.103 0.00192 **
## a3 7.766e-02 3.449e-02 2.252 0.02432 *
## b1 3.775e-14 1.765e-01 0.000 1.00000
## b2 1.090e-02 1.756e-01 0.062 0.95050
## b3 1.652e-02 1.070e-01 0.154 0.87724
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Diagnostic Tests:
## Jarque Bera Test
##
## data: Residuals
## X-squared = 2940.1, df = 2, p-value < 2.2e-16
##
##
## Box-Ljung test
##
## data: Squared.Residuals
## X-squared = 7.6426, df = 1, p-value = 0.0057
GARCH(3,3) in which coefficients has 3 insignificants, normality is quite bad and has no problem with auto correlation. and GARCH(3,3) model is also trying to over fit the data similarly as GARCH(2,2) model.
sc.AIC = AIC(m.11, m.22, m.12, m.33)
sort.score(sc.AIC, score = "aic")
## df AIC
## m.11 3 9674.087
## m.33 7 9993.283
## m.22 5 10061.863
## m.12 4 10079.420
When we observe AIC values for all the possible model, GARCH(1,1) has lowest AIC value with 9674.087 and all the coefficients are significant and hence we consider GARCH(1,1) model
Observing the residual analysis of the series, considering histogram - it is slightly skewed, ACF and PACF standardised residuals does not show any seasonal patterns and it is more of white noise present. The QQ plot and Ljung-Box test shows some division from normality but this can be attributed to the volatility in variance stable present in the data.
residual.analysis(m.11, class="GARCH", start=2)
##
## Shapiro-Wilk normality test
##
## data: res.model
## W = 0.90379, p-value < 2.2e-16
## Warning in (ra^2)/(n - (1:lag.max)): longer object length is not a multiple
## of shorter object length
m.11_2 = garchFit(formula = ~garch(1,1), data =bitcoin.ts )
##
## Series Initialization:
## ARMA Model: arma
## Formula Mean: ~ arma(0, 0)
## GARCH Model: garch
## Formula Variance: ~ garch(1, 1)
## ARMA Order: 0 0
## Max ARMA Order: 0
## GARCH Order: 1 1
## Max GARCH Order: 1
## Maximum Order: 1
## Conditional Dist: norm
## h.start: 2
## llh.start: 1
## Length of Series: 1772
## Recursion Init: mci
## Series Scale: 3042.573
##
## Parameter Initialization:
## Initial Parameters: $params
## Limits of Transformations: $U, $V
## Which Parameters are Fixed? $includes
## Parameter Matrix:
## U V params includes
## mu -5.08569054 5.085691 0.5085691 TRUE
## omega 0.00000100 100.000000 0.1000000 TRUE
## alpha1 0.00000001 1.000000 0.1000000 TRUE
## gamma1 -0.99999999 1.000000 0.1000000 FALSE
## beta1 0.00000001 1.000000 0.8000000 TRUE
## delta 0.00000000 2.000000 2.0000000 FALSE
## skew 0.10000000 10.000000 1.0000000 FALSE
## shape 1.00000000 10.000000 4.0000000 FALSE
## Index List of Parameters to be Optimized:
## mu omega alpha1 beta1
## 1 2 3 5
## Persistence: 0.9
##
##
## --- START OF TRACE ---
## Selected Algorithm: nlminb
##
## R coded nlminb Solver:
##
## 0: 1619.0651: 0.508569 0.100000 0.100000 0.800000
## 1: 1172.3233: 0.505515 0.0395530 0.0983083 0.768570
## 2: 1084.7582: 0.504424 0.0269932 0.0989388 0.766606
## 3: 1039.0429: 0.503424 0.0188787 0.0998665 0.765991
## 4: 1020.7062: 0.502291 0.0139879 0.101397 0.766177
## 5: -1192.8976: 0.0629292 1.00000e-06 0.474047 0.226566
## 6: -1211.1058: 0.0629295 0.000245562 0.474047 0.226566
## 7: -1520.8968: 0.117178 0.000173310 0.447324 0.166679
## 8: -1537.8351: 0.139166 1.00000e-06 0.473131 0.179992
## 9: -1564.1550: 0.144517 0.000191993 0.479793 0.183599
## 10: -1584.4856: 0.135685 0.000186524 0.471144 0.179981
## 11: -1596.2220: 0.135685 0.000146300 0.471144 0.179981
## 12: -1620.9977: 0.135685 6.58526e-05 0.471145 0.179981
## 13: -1626.8672: 0.135685 3.93275e-05 0.471145 0.179981
## 14: -1627.2849: 0.135685 3.21168e-05 0.471145 0.179981
## 15: -1627.2968: 0.135685 3.27893e-05 0.471150 0.179987
## 16: -1724.3301: 0.134461 8.31314e-06 0.554552 0.263641
## 17: -1744.1923: 0.134198 3.06259e-05 0.556166 0.381780
## 18: -1753.1004: 0.141794 4.33218e-06 0.555518 0.438950
## 19: -1763.5613: 0.138678 2.29132e-05 0.609971 0.334274
## 20: -1770.3297: 0.137236 1.75086e-05 0.633725 0.331378
## 21: -1778.9562: 0.136781 1.07701e-05 0.717598 0.248166
## 22: -1782.2780: 0.138274 3.51663e-06 0.826230 0.171386
## 23: -1785.5741: 0.139076 1.08441e-05 0.850236 0.135528
## 24: -1786.1220: 0.137777 1.13508e-05 0.825021 0.170489
## 25: -1787.4318: 0.138040 1.12697e-05 0.854767 0.139192
## 26: -1789.9944: 0.138591 1.13501e-05 0.976841 0.0170062
## 27: -1791.2668: 0.138013 1.18009e-05 1.00000 1.00000e-08
## 28: -1791.3079: 0.138062 1.24714e-05 1.00000 0.00626917
## 29: -1791.3360: 0.138085 1.24408e-05 1.00000 0.00341715
## 30: -1791.3384: 0.138108 1.24705e-05 1.00000 0.000645068
## 31: -1791.3402: 0.138123 1.22530e-05 1.00000 0.00264211
## 32: -1791.3418: 0.138109 1.24528e-05 1.00000 0.00237076
## 33: -1791.3423: 0.138114 1.24118e-05 1.00000 0.00201376
## 34: -1791.3423: 0.138114 1.24092e-05 1.00000 0.00202393
## 35: -1791.3423: 0.138114 1.24093e-05 1.00000 0.00202302
##
## Final Estimate of the Negative LLH:
## LLH: 12420.91 norm LLH: 7.009543
## mu omega alpha1 beta1
## 420.22138628 114.87585351 0.99999999 0.00202302
##
## R-optimhess Difference Approximated Hessian Matrix:
## mu omega alpha1 beta1
## mu -0.517851714 3.776833e-03 0.6347629 4.292357
## omega 0.003776833 -6.249554e-06 4.6253909 0.120951
## alpha1 0.634762862 4.625391e+00 -861.2707373 -956.508287
## beta1 4.292357411 1.209510e-01 -956.5082867 -3853.645171
## attr(,"time")
## Time difference of 0.1500618 secs
##
## --- END OF TRACE ---
## Warning in sqrt(diag(fit$cvar)): NaNs produced
##
## Time to Estimate Parameters:
## Time difference of 0.8147099 secs
summary(m.11_2)
##
## Title:
## GARCH Modelling
##
## Call:
## garchFit(formula = ~garch(1, 1), data = bitcoin.ts)
##
## Mean and Variance Equation:
## data ~ garch(1, 1)
## <environment: 0x000000001ecf36b0>
## [data = bitcoin.ts]
##
## Conditional Distribution:
## norm
##
## Coefficient(s):
## mu omega alpha1 beta1
## 420.221386 114.875854 1.000000 0.002023
##
## Std. Errors:
## based on Hessian
##
## Error Analysis:
## Estimate Std. Error t value Pr(>|t|)
## mu 4.202e+02 1.396e+00 300.918 <2e-16 ***
## omega 1.149e+02 NA NA NA
## alpha1 1.000e+00 1.139e-03 878.148 <2e-16 ***
## beta1 2.023e-03 1.632e-02 0.124 0.901
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log Likelihood:
## -12420.91 normalized: -7.009543
##
## Description:
## Mon Jun 24 16:25:56 2019 by user: Vikrant
##
##
## Standardised Residuals Tests:
## Statistic p-Value
## Jarque-Bera Test R Chi^2 162.7808 0
## Shapiro-Wilk Test R W 0.7688123 0
## Ljung-Box Test R Q(10) 14535.87 0
## Ljung-Box Test R Q(15) 21070.86 0
## Ljung-Box Test R Q(20) 27223.53 0
## Ljung-Box Test R^2 Q(10) 98.28621 1.110223e-16
## Ljung-Box Test R^2 Q(15) 106.5728 7.771561e-16
## Ljung-Box Test R^2 Q(20) 109.608 2.320366e-14
## LM Arch Test R TR^2 87.95927 1.224576e-13
##
## Information Criterion Statistics:
## AIC BIC SIC HQIC
## 14.02360 14.03597 14.02359 14.02817
When we observe the garchFit summary of GARCH(1,1) model with all the parameter estimates. As observed, all the parameters are statistically significant. The statistical test of standardised residuals appeared to be satisfactory.
par(mfrow=c(1,1))
plot((fitted(m.11)[,1])^2,type='l',ylab='Conditional Variance',xlab='t',main="Estimated Conditional Variances of the Daily Returns")
# Changes in conditional variance at the beginning of the series and between observations 300 and 400, then the conditional variance settles down.
#
fGarch::predict(m.11_2,n.ahead=7,trace=FALSE,plot=TRUE)
## meanForecast meanError standardDeviation lowerInterval upperInterval
## 1 420.2214 11103.57 11103.57 -21342.38 22182.82
## 2 420.2214 11114.80 11114.80 -21364.39 22204.84
## 3 420.2214 11126.05 11126.05 -21386.43 22226.87
## 4 420.2214 11137.30 11137.30 -21408.48 22248.93
## 5 420.2214 11148.56 11148.56 -21430.56 22271.01
## 6 420.2214 11159.84 11159.84 -21452.66 22293.11
## 7 420.2214 11171.13 11171.13 -21474.79 22315.23
# Forecasts for the confidance limits are based on the forecasts of conditional variance.
The above prediction is made for GARCH(1,1) model, which has upper and lower bounce based on the confidence interval. The actual value is Red and the upper and lower bounce values are in blue and green. There is a huge difference in upper and lower bounce which is due to the high volatility in the variance of series.
model<-ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)),
mean.model = list(armaOrder = c(0, 0), include.mean = FALSE),
distribution.model = "norm")
m.11_3<-ugarchfit(spec=model,data=bitcoin.ts)
plot(m.11_3, which="all")
##
## please wait...calculating quantiles...
forc = ugarchforecast(m.11_3, data = bitcoin.ts, n.ahead = 10)
Visualuisation of the GARCH(1,1) model shows the predictive value against the actual data in the series, followed by the ACF and PACF for the squared observations and residual analysis of the model.
Forecasted value when compared to the actual value shows the continuous decrease in bitcoin value. The forcasted value are in red while the actual values are in blue. We can observe the mean absolute and squared error values of the model’s accuracy of this prediction.
fitted = as.numeric(forc@forecast$sigmaFor)
observed = read.xlsx("Bitcoin_Prices_Forecasts(1).xlsx", sheetIndex = 1)
mase <- MASE(observed$Closing.price, fitted)
mase$MASE[1,1]
## [1] 1.074513
plot(as.vector(bitcoin.ts), type="l", xlim=c(1740, 1800), main="Forecast vs Actual values of Bitcoin prcie", ylab="BitCoin price(USD)")
lines(seq(1772, 1781), forc@forecast$sigmaFor, col="blue")
lines(seq(1772, 1781), observed$Closing.price, col="red")
legend(1740, 15000, legend=c("Actual", "Forecasted"), col=c("red", "blue"), lty=c(1,1))
Observing the mean absolute scaled error of all possible models, although it is observed that higher order model provide low mean absolute scaled error. The differences are not big enough to adopt such a complex model.
From the time series analysis that we have done in this assignment, the final model that can be considered is GARCH(1,1) model, When we observe AIC values for all the possible model, GARCH(1,1) has low AIC value with 9674.087 and also all the coefficients are significant and with the MASE score 1.074.