In my sentiment analysis project I wanted to evaluate the efficiency of Twitter Sentiment Analysis as a tool of prediction for the stock market.
My first idea was to do so using Granger's Causality Test. The Granger causality test is a statistical hypothesis test, expressed by Clive Granger in 1969 and later expanded, for determining whether one time series in useful in forecasting another.
A time serie X is said to Granger-cause a second time serie Y if, conditioning by the past value of X, the MSQ of the forecast
This is not, though, exactly what I wanted to achieve. The problem was that I had built an automated task that downloaded all the tweet relative to a firm at the open of the stock market, and I wanted to research if this data was useful to predict the valuation of the firm at the closing of the market. The Granger Test wasn't exactly what I needed, because it would have compared the closing price to the tweet downloaded the day before. For this reason, we want the first MSQ not only conditioned by the past value of X, but also the present value. Besides that, we want that the information the tweets give to us at the opening of the stock market are useful to predict the closing price taking into account all the informations that is available at that moment: the more useful of all beign the opening price of the stock.
In conclusion according to our Close Tes, our sentiment time serie S is said to cause the time serie of the closing prices C if, conditioning by the past and present value of S, and by the present and past value of the time serie of the opening price O, the MSQ of the forecast
The way this test is calculated is very similar to the Granger Test. The G.Test is infact only an F test on the joint significance of the retarded value of X in the complete method. In the same way, the Close Test builds a linear model with past values of C, present and past values of S, and present and past values of O. After that, the test computes the F test on the joint significance of the present and past values of S.