## 5 Experimental Results
### Correlation Discovery: Dynamic Time Warping  
A first attempt was to find out whether there was a correlation at common intervals, overlaps, between the intervals of the time series close, sentimentScore and close, numTweets, in which patterns were found. However, this approach did not work satisfactorily. The next step was to discover if a correlation existed between the time series:  
* close and sentimentScore
* close and numTweets,  
to use the DTW algorithm. First, for each of the five stocks (AAPL, GE, IBM, MSFT and ORCL), we measured the DTW distance between the close time series and the sentimentScore time series. We measured the DTW distance between the two time series at the intervals of close time series, where patterns were found via the GrammarViz 2.0 API, \(\pm 3\) units. For each rule, we found the Mean Value (M.V.) of the DTW distance of intervals that compose this rule. Tables S11-S15 show the DTW distances for AAPL, GE, IBM, MSFT and ORCL, respectively. Then, random windows of \(w\) length were selected for the time series. Thus, we compared the mean value of the DTW distance of each rule to the mean value of the DTW distance of the random windows. If the mean value of the DTW distance of rules was smaller than the mean value of the DTW distance of the random window, then there was a correlation between the time series at the intervals of rules where patterns were found in the close time series (Figure 6). Figure 5: Rule \(R\#5\) from AAPL close time series, as illustrated by GrammarViz 2.0. The frequency of the pattern is three times on intervals [35; 61], [74; 93] and [100; 121]. Rule \(R\#5\) represents these three intervals. The two time series are considered to be similar when the value of their distance is close to zero. On the other hand, when the distance is closer to one, that means that there is difference between the two time series. For example, we compared the mean value (M.V.) of the rules of the patterns that were found for AAPL company (stock) (Supplementary Material file, Table S11) with the mean value of the random windows. As seen, the mean value of the distance of the \(R\#1\) rule is equal to 0.179, but in Table S16, the mean value of the random window for the AAPL stock is smaller than this of \(R\#1\) rule. Thus, for the intervals of the rule \(R\#1\), we cannot say that there is a correlation between the two time series. On the other hand, for the rule \(R\#2\) (Supplementary Material file, Table S11), the mean value of the distance is equal to 0.068. In Table S16, we will see that there are random windows for which their mean value is bigger than the mean value of \(R\#2\). This means that there is a correlation between the two time series in ((4, 21), (79, 98)) intervals of the \(R\#2\). In addition, Table S16 depicts the random windows that we have taken for the five companies (AAPL, GE, IBM, MSFT, ORCL). Table S17 of the Supplementary Material file gives an overview of all the rules of the five companies where there is a correlation, i.e., a small DTW distance between the two time series. There are many rules with a small DTW distance, thus there is a correlation between close and sentimentScore time series (i.e., between closing price and news). In order to check if there is a correlation between the time series of closing prices (close) and the number of tweets (numTweets), we followed the same steps as for the closing price and news. We measured the DTW distance between the close and the numTweets time series. Tables S18-S22 of the Supplementary Material file show the distances for each stock that were found via the DTW algorithm. For each rule, the mean value of the distances of intervals, which are composing the rule, is calculated. The process to find if there is a correlation between the two time series is the same as the process of the close and the sentimentScore time series. In more detail, we compared the mean value of rules with the mean value of the random windows.