|
1 | 1 | # Time-Series-Analysis-using-Twitter
|
2 |
| -Perform time series analysis to predict future customer sentiment on Twitter |
| 2 | +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. |
| 3 | + |
| 4 | +#### About the Data |
| 5 | + |
| 6 | +The data contains the average hourly sentiment of tweets customers sent to AT&T’s Twitter handle. |
| 7 | + |
| 8 | +#### Let's dig into it |
| 9 | + |
| 10 | +Packages used in this code are: |
| 11 | +- forecast |
| 12 | +- timeSeries |
| 13 | +- rugarch |
| 14 | + |
| 15 | +The initial time series plot is given below: |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +Let's see if our time series is random walk process or not and for that, I will write these codes in R |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +Since the p-val = 0.01, hence rejection of null hypothesis and hence it is not Random-Walk. |
| 24 | + |
| 25 | +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. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +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. |
| 30 | + |
| 31 | +I am using auto arima model for finding out the best ARIMA model for this data. |
| 32 | + |
| 33 | + |
| 34 | +Now, we must check ARCH adn GARCH models and for that, I am using ***rugarch*** package with ***sGARCH*** specifications. |
| 35 | + |
| 36 | +<img width="333" alt="img5" src="https://user-images.githubusercontent.com/13045656/77778448-60e6df00-7027-11ea-896f-606b331c7b5b.PNG"> |
| 37 | + |
| 38 | +The ***value for AIC: -3.4473 and BIC: -3.4392*** for this model. Now, I will try with armaOrder(0,1). |
| 39 | + |
| 40 | +<img width="323" alt="img6" src="https://user-images.githubusercontent.com/13045656/77778549-8d026000-7027-11ea-8363-759323c2e110.PNG"> |
| 41 | + |
| 42 | +The ***value for AIC : -3.4451 and BIC : -3.4348***. Now, doing the same thing all over again but with ***apARCH*** specifications. |
| 43 | + |
| 44 | +<img width="327" alt="img7" src="https://user-images.githubusercontent.com/13045656/77778729-d5218280-7027-11ea-92a6-5f87b48ea039.PNG"> |
| 45 | + |
| 46 | +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***. |
| 47 | + |
| 48 | +#### Conclusion and Findings |
| 49 | + |
| 50 | +Lets compare the value of AIC and BIC for GARCH and apARCH with armaOrder(0,0) and (0,1). |
| 51 | + |
| 52 | +For Garch with armaOrder(0,0): The value for AIC: -3.4473 and BIC: -3.4392 |
| 53 | +For Garch with armaOrder(0,1): The value for AIC : -3.4451 and BIC : -3.4348 |
| 54 | +For apArch with armaOrder(0,0): The value for AIC = -3.6601 and BIC = -3.6478 |
| 55 | +For apArch with armaOrder(0,1): The value for AIC = -3.6672 and BIC = -3.6529 |
| 56 | + |
| 57 | +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. |
| 58 | + |
| 59 | +**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.** |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
0 commit comments