I am trying to run a forecast of bitcoin returns with the sentiment score of twitter. However, after running the following code I get a plot for the forecast but with just a horizaontal line. Seems weird, since it does not go up or down. This is my code prior the forecasting:
adf.test(BTC_USD_data$total_score)
ggAcf(BTC_USD_data$total_score)
ggPacf(BTC_USD_data$total_score)
#Bitcoin returns
adfTest(BTC_USD_data$return)
plot(BTC_USD_data$return)
ggAcf(BTC_USD_data$return)
ggPacf(BTC_USD_data$return)
m1 <- auto.arima(BTC_USD_data$return, xreg = BTC_USD_data$total_score, trace = TRUE, seasonal = FALSE, stepwise = FALSE, approximation = FALSE)
#4,0,0
summary(m1)
autoplot(m1)
checkresiduals(m1)
test(resid(m1))
adf.test of BTC_USD_data$total_score is:
Warning: p-value smaller than printed p-value
Augmented Dickey-Fuller Test
data: BTC_USD_data$total_score
Dickey-Fuller = -8.7682, Lag order = 23, p-value = 0.01
alternative hypothesis: stationary
ACF and PACF for the total_score are:
The summary of the first auto.arima model m1 is:
Series: BTC_USD_data$return
Regression with ARIMA(4,0,0) errors
Coefficients:
ar1 ar2 ar3 ar4 intercept xreg
-0.0057 -0.0233 0.0003 -0.0364 2e-04 0
s.e. 0.0089 0.0088 0.0091 0.0095 1e-04 0
sigma^2 = 7.837e-05: log likelihood = 43352.11
AIC=-86690.21 AICc=-86690.21 BIC=-86637.85
Training set error measures:
ME RMSE MAE MPE MAPE MASE ACF1
Training set -2.397527e-07 0.008850779 0.005827579 -Inf Inf 0.6825662 -0.0001918203
The autoplot for the first model from the auto.arima is
Then I just a train part and a test part for BTC and also the xreg(tweets sentiment total score). Eventually running the auto.arima on the train part and forecasting. However, before doing that I made a new time series with only containing the total score of a tweet and the return on that time. :
BTC_tweets_df <- as.data.frame(cbind(BTC_USD_data$return, BTC_USD_data$total_score))
colnames(BTC_tweets_df) <- c("return", "total_score")
BTC_TS <- ts(BTC_tweets_df, frequency = 60 , start = c(2021, 12), end = c(2022, 06))
btc_train <- window(BTC_TS, end = c(2022, 01))
btc_test <- window(BTC_TS, start = c(2022, 01))
forecastbtc <- forecast(arimabtc_train, xreg = rep(btc_test), 2)
autoplot(forecastbtc)
This results in the following autoplot of the forecast:
The forecast does not seem to be legitimate. Either I am doing something wrong, or something else is going on. Anyone an idea?