The objective of this study is to find the right time series model to make predictions about the future customer sentiment in Twitter network of AT&T.
The data contains the average hourly sentiment of tweets customers sent to AT&T’s Twitter handle.
Packages used in this code are:
- forecast
- timeSeries
- rugarch
The initial time series plot is given below:
Let's see if our time series is random walk process or not and for that, I will write these codes in R
Since the p-val = 0.01, hence rejection of null hypothesis and hence it is not Random-Walk.
Let's use ACF and PACF to determine if the times series has any MA or AR process and if it has, what is the order.
If you look carefully, the first one only crosses the line and there is no line before that which is below the dotted line and therefore , I can say the order is 1.
I am using auto arima model for finding out the best ARIMA model for this data.
Now, we must check ARCH adn GARCH models and for that, I am using rugarch package with sGARCH specifications.
The value for AIC: -3.4473 and BIC: -3.4392 for this model. Now, I will try with armaOrder(0,1).
The value for AIC : -3.4451 and BIC : -3.4348. Now, doing the same thing all over again but with apARCH specifications.
The value for armaOrder(0,0) AIC = -3.6601 and for BIC = -3.6478 and for armaOrder(0,1) , we have AIC = -3.6672 and BIC = -3.6529.
Lets compare the value of AIC and BIC for GARCH and apARCH with armaOrder(0,0) and (0,1).
For Garch with armaOrder(0,0): The value for AIC: -3.4473 and BIC: -3.4392 For Garch with armaOrder(0,1): The value for AIC : -3.4451 and BIC : -3.4348 For apArch with armaOrder(0,0): The value for AIC = -3.6601 and BIC = -3.6478 For apArch with armaOrder(0,1): The value for AIC = -3.6672 and BIC = -3.6529
It is said that lesser the value for BIC and AIC, better the model. So first we will check BIC for all the models and if BIC is same for any of the two moel, AIC will come in picture.
As we observe, BIC for apArch with armaOrder(0,1) is least and I would choose this specification for predicting the future values over all the other specifications.
Any suggestions or comments are welcome at anshusingh7091994@gmail.com.