# Dynamic Functional Principal Components for Testing Causality
## 3 Testing Linear Causality
### Three Procedures for Testing the Causality
We wanted to test the causal relation between these two variables: the electricity demands and the temperatures. To do so, we used the three algorithms. As in article [23], we found a dependency between this two variables. Everyday, the temperatures in Adelaide impact the electricity demands in this city. ### Results of F-Causality Algorithm

In order to test the causality between the electricity demands and the measured temperatures based on F-causality, some parameters need to be defined. Hence, the ncv was set to 100, and the number of replication (sample size) was set to 508. A generic test was performed between all days for the causality testing. For each test, a couple of results are calculated by finding the optimal \(K\) value, and results of the method are included in Table 4. The line represents the electricity demand each day, and the column represents the temperature measured in the airport. Table 4 reports the optimal \(K\) value and causality result (\"True\" or \"False\") for each couple. From both tables, we can clearly observe that with the optimal parameter method, the temperature affects the daily electricity demand, except on Tuesday and Wednesday. Moreover, it is also observed that the temperature on a given day may cause the electricity demand another day, which is explained by a similarity of temperatures. Figure 6: Electricity demand in Adelaide for Thursday. Figure 7: Temperature in Adelaide for Thursday. ### Results of the Dynamic FPCA Algorithm

To perform the dynamic FPCA causality test, the same parameters as in F-causality are set. Moreover, in each couple of tests, the causality is calculated with different values of d parameter 1, 2 and 3, and results are presented in Table 5.

Table 5 reports the causality result in terms of percentage for each couple. Firstly, the obtained results when \(d\) is set to 2 and 3 are not discriminative since they show high causality for all couples. Secondly, it can be noticed that the temperature causes the electricity demand each day. Furthermore, it is also observed that the temperature on a given day may cause the electricity demand another day. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \(K\)**Optimal** & **Monday** & **Tuesday** & **Wednesday** & **Thursday** & **Friday** & **Saturday** & **Sunday** \\ \hline Monday & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ True & True & False & False & False & False & False & True \\ True & 1 & 1 & 1 & 1 & 1 & 1 \\ Tuesday & False & False & False & False & False & False & False \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ Wednesday & False & False & False & False & False & False & False \\ Thursday & 1 & 1 & 1 & 1 & 1 & 1 \\ False & False & False & False & True & True & False \\ Friday & 1 & 1 & 1 & 1 & 1 & 1 \\ False & False & False & False & False & True & False \\ Saturday & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ False & False & False & False & False & False & True & False \\ Sunday & 1 & 1 & 1 & 1 & 1 & 1 \\ True & False & False & False & False & False & False & True \\ \hline \hline \end{tabular}
\end{table} 
Table 4: F-causality tests between temperature and electricity demand with an optimal parameter. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & **Monday** & **Tuesday** & **Wednesday** & **Thursday** & **Friday** & **Saturday** & **Sunday** \\ \hline Monday & 95\% & 61\% & 13\% & 30\% & 65\% & 96\% & 44\% \\ Monday & 99\% & 99\% & 99\% & 99\% & 99\% & 99\% & 99\% \\ \hline Tuesday & 96\% & 95\% & 84\% & 33\% & 66\% & 88\% & 18\% \\
99\% & 99\% & 99\% & 99\% & 99\% & 99\% & 99\% \\ \hline Wednesday & 58\% & 54\% & 98\% & 82\% & 39\% & 92\% & 51\% \\
99\% & 99\% & 99\% & 99\% & 99\% & 99\% & 99\% \\ \hline Thursday & 39\% & 20\% & 77\% & 99\% & 58\% & 88\% & 82\% \\
99\% & 99\% & 99\% & 99\% & 99\% & 99\% & 99\% \\ \hline Friday & 54\% & 73\% & 94\% & 6\% & 98\% & 63\% & 99\% \\
99\% & 99\% & 99\% & 99\% & 99\% & 99\% & 99\% \\ \hline Saturday & 54\% & 85\% & 96\% & 73\% & 88\% & 97\% & 99\% \\
99\% & 99\% & 99\% & 99\% & 99\% & 99\% & 99\% \\ \hline \hline \end{tabular}
\end{table}