1. Modeling
  1. Prelude to modeling

Initially we look at different models that would be appropriate for the respective price series.

library(astsa)
library(forecast)
orig1 <- orig
orig1[,1]=as.POSIXct(orig[,1])
orig2 <- as.ts(orig1, order.by = more_coins$time)
# functions used
# z=1
# for(q in 0:7){
#   for(p in 0:7){
#     
#     if(p+z+q<=7){
#       model <- arima(x=log(orig$Neo), order = c((p),z,(q)))
#       pval <- Box.test(model$residuals, lag=log(length(model$residuals)))
#       sse <- sum(model$residuals^2)
#       cat(p,d,q,'AIC=', model$aic, ' SSE=',sse,' p-VALUE=', pval$p.value,'\n')
#     }
#   }
# }

Residuals for all coins for model ARIMA (0, 1, 6)

residuals = matrix(nrow = 18752, ncol = 21)
for (i in 2:21){
  order = c(0,1,6)
  model = arima(log(orig2[,i]), order = order)
  residuals[,i] = model$residuals
}
residuals = residuals[,2:21]
# Change column names
colnames(residuals) <- c('Bitcoin', 'Bitcoin Cash', 'Bitcoin Gold', 'Cardano', 'Dash',
                         'Nem', 'Eos', 'Ethereum', 'Ethereum Classic', 'Iota', 'Lisk', 
                         'Litecoin', 'Monero', 'Neo', 'Ripple', 'Stellar', 'Tether',
                         'Tron', 'Zcash', 'Dogecoin')

Plot ACF and PACF of the residuals:

for (i in 1:20){
  acf2((residuals[,i]),main=paste("ACF/PACF of residuals:", colnames(residuals)[i]))
}