Dynamic Functional Principal Components for Testing Causality

: In this paper, we investigate the causality in the sense of Granger for functional time series. The concept of causality for functional time series is deﬁned, and a statistical procedure of testing the hypothesis of non-causality is proposed. The procedure is based on projections on dynamic functional principal components and the use of a multivariate Granger test. A comparative study with existing procedures shows the good results of our test. An illustration on a real dataset is provided to attest the performance of the proposed procedure.


Introduction
Functional data analysis has become an important field of modern statistics, and now an abundant literature on this topic exists. The monograph of [1] is an introductory source with very valuable examples and techniques for the analysis of functional data. Another standard book about functional data analysis is [2]. As a good introduction to dependent functional data and functional time series, we recommend the monographs of [3,4]. Recently, the classical notion of causality in the sense of Granger (see [5]) has been extended to the functional time series cases. This extension is important and useful to the statistical community. The notion of Granger causality test can be explained as a statistical hypothesis test that measures the usefulness of adding a variable to forecast another variable. Granger causality is a predictive notion of causality. The causality for functional time series has been studied from a Granger point of view by Saumard [6]. The procedure was used in two application research articles; Almanjahie et al. [7] studied the relations between oil prices and the gross domestic product and Sancetta [8] with an application in financial econometrics. In this article, we provide a new testing procedure based on dynamic functional principal components.
Since the pioneering work of [5,9], an abundant literature has become available on causality of classical time series (for a broader review see [10,11]). In fact, there are various possible approaches for defining causality, notably causality in the frequency domain [12], a nonparametric approach [13], and causality on Bayesian networks [14]. Furthermore, the wide range of applications (causality in econometrics, neuroscience, social science, biomedical, signals) indicates the central role of causality in science.
In this article, we recall the notion of causality for functional stationary time series and propose tests of non-causality. There are nowadays different tools to analyze dependency on functional data, such as a mixing, linear process [3,15], where a definition of dependency on functional data has been proposed that generalizes the m-dependency, called L p − mapproximable sequences. This notion is exploited to theoretically justify the "F-causality" test. "F-causality" stands for functional causality. This first test exploits the functional nature of the data and adapts a test of equality between operators for stationary functional time series (see [16]) to the context of causality. This test is explained in detail in [6]. The proposed test relies on functional dynamic principal components, which are able to capture the variability of functional time series better than functional principal components as demonstrated in [17]. Once we obtain the dynamic FPCA scores, we make the decision by using a multivariate Granger test on the scores. Aue et al. [18] use the same idea for predicting functional time series. Our dynamic-FPCA based procedure is publicly available at https://github.com/PyMattAI/DynamicFPCA_Causality.git (accessed on 7 June 2021) In order to compare, we studied another procedure that does not use the functional nature of the data, which is called the classical test. This procedure is based on differentiating the time series and using a multivariate Granger test.
A functional time series is a sequence of functional objects that are dependent. For example, in Figure 1, a classical time series of monthly sea surface temperatures (in°C) from January 1982 to December 2018 is plotted. These sea surface temperatures were measured by Moore buoys in the 'Niño region'. The functional versions of the same data points are represented in Figure 2. One functional observation represents the sea surface temperature for one year. From the 12 × 37 data of the classical time series, we generate 37 observations of a functional time series that are observed each month. More generally, a functional time series X t (u), where t = 1, . . . , N (N is the sample size of the functional time series) and u ∈ [0, 1] (where there are m points by functional observations we observe at the points u i i = 1, . . . , m from [0, 1]) can be generated from a classical time series x t where t = 1, . . . , N * m, with m being the number of observations points. We have the relation  The functional time series must be stationary in order for our test to perform well. It is worth mentioning that stationarity for functional time series and stationarity for classical time series are quite different. For example, we could have a stationary functional time series from a classical time series that is not stationary. Mainly, it is the case when the classical time series has a seasonality over a period T, and we cut this series at these intervals of time.The classical time series appears non-stationary, but if we consider the data as functional observations, it can be stationary. Hence, our test provides a natural framework to test causality for classical non-stationary time series. The application of a traditional test and our procedure to the real dataset highlight this fact.
In Section 2, the definition of causality for functional stationary time series and an example in the autoregressive functional processes are introduced. In Section 3, we recall how we can estimate the dynamic FPCA and propose three algorithms for testing the noncausality including the dynamic FPCA-based testing procedure. We conclude this article with Sections 4 and 5, which are developed to empirically analyze the testing procedure, and an application of the procedure to explain the relation between electricity demand and temperature in Australia.

Definition
Let H be a separable Hilbert space, with its inner product ·, · and the norm associated h = h, h , ∀h ∈ H. We take H = L 2 [0, 1] for simplicity. Thereafter, for every functional time series {Z t } t∈Z valued in H, we make the assumptions that E Z t 2 < +∞ and E[Z t ] = 0, ∀t ∈ Z; moreover, we assume that {Z t } t∈Z is strongly stationary. Let us recall the two definitions: strongly and weakly stationary. We say that series of random functions (Z t ) are strongly stationary if for any h ∈ Z, k ∈ N and any sequence of indices t 1 , . . . , t k , (Z t 1 , . . . , Z t k ) and (Z h+t 1 , . . . , Z h+t k ) are identically distributed. We say that {Z t } t∈Z is weakly stationary if for all t we have: Let us introduce a key concept in functional data analysis about the second-order property of the process. To understand why this operator is a key concept, we recommend reading [19]. We define the operator of covariance Γ Z of the stationary functional time series Z t by: where we omit the index t of time, due to stationarity. It is well known that this operator is a self-adjoint, positive, nuclear operator. Let X t and Y t be two stationary functional time series valued in H. Let U t be the information accumulated since time t − 1, and U t − X t denote all this information without the series X t . Define the predictive error series by whereŶ t (U) is the best linear predictor of Y t using the information U t . Then, we have the following definition.
This definition is a natural extension of the idea of causality studied by Granger [5]. In fact, we replace the variance of the time series by the covariance operator of the functional time series. In addition, in order to compare covariance operator, we assume that a symmetric operator A is greater than a symmetric operator B if the difference A − B is a positive definite operator. This is a theoretical definition because, in general, we do not have access to the information U t , so we must be careful for the conclusions in practice.

An Example
where ρ is a linear operator of H and ε is a H-strong white noise. For more information on the definition of autoregressive process valued in separable Hilbert space, see [3]. We have We can rewrite the model as (1) , ) and the same idea for ρ 21 and ρ 22 . The symbol f A stands for the restriction of the function f on the subset A of a definition set. The notation F (1) for an operator F, whose image is on a product space, means we take only the first component of the operator. According to the Definition 1, we say that (X t ) does not linearly cause (Y t ) if and only if ρ 12 = 0. In fact, if ρ 12 = 0, the two covariance operators of the definition are equals, and then the difference between the operators cannot be positively defined.

Dynamic FPCA
Hörmann et al. [17] have proposed a dynamic version of functional principal component analysis (FPCA) that is more efficient for functional time series than the traditional FPCA. As stated by [17] "classical static FPCs still can be consistently estimated, but, in contrast to the i.i.d. setup, they will not lead to an adequate dimension reduction technique". In fact, the dynamic FPCs tend to recover the process better than the traditional FPCs. In this section, we recall briefly the practical aspects of this method. We consider a functional time series (X t : t ∈ Z) where X t takes values in L 2 [0, 1]. We assume here that (X t : t ∈ Z) is weakly stationary. We define the autocovariance kernels c h by We denote C h , h ∈ Z as the operator corresponding to the autocovariance kernels as c h and C h as the empirical counterpart of C h at lag h. We define the estimated spectral density operator at frequency θ: Then, we can estimate the m-th dynamic functional principal score by where L is some integer and φ ml are the m-th estimated dynamic FPC filter coefficients coming from the fourier transform of the eigenfunction of F θ .

Three Procedures for Testing the Causality
This first testing procedure is called F-causality (see Algorithm 1) and is explained in detail in [6]. We propose an enhanced procedure (see Algorithm 2) inspired by [18] and by [17] based on dynamic functional principal components. This is the second testing procedure. In this case, the number of dynamic functional principal components (d and d ) can be chosen to explain a reasonable part of the variance (for example, 85%). This second procedure is called Dynamic-FPCA. We propose a last procedure, called the Classical test. This last procedure is based on differentiating the series, which are viewed as classical time series of period m.
Recall that we have H 0 : No causal relation, H 1 : causal relation, and in the case of FAR(1), this is equivalent to We present the three procedures of testing non-causality under the form of the Algorithms 1-3. Algorithm 1 refers to first testing procedure (F-causality). The second one (Algorithm 2) is based on the scores of the dynamic functional principal components, and the second testing procedure (Dynamic-FPCA). The last one (Algorithm 3) refers to the classical testing procedure (Classical).
(Estimation of the parameters) We perform the estimation of ρ according to the previous section. We separate the two different models, one estimation of ρ without the Y i (nested model) and one that includes them (pooled model).

3.
(Estimation of the errors) ε 1 is then estimated in the different models for t = 2, . . . , n, by (time series) We obtain two "classical" time series (x 1 , . . . , x m * n ) and (y 1 , . . . , y m * n ) by not viewing them as functional time series. 3.
(Differencing) Due to the potentially non-stationarity of these classical time series, we use the differencing technique of period m.

4.
Use a multivariate test to conclude.

Design of the Experiments
A simulation study was developed to check the performance of the three procedures. We used R software, namely package "fda" [20], "far" [21] and "freqdom.fda". To verify the results of our test under the Null and the alternatives, we simulated different scenarios. We used the packages "far" in order to simulate functional time series and to estimate the parameters of the models, the package "fda" to perform the test of equality of covariance and the package "freqdom.fda" to compute the dynamic FPCA scores. Under the null, we used three independent functional time series and one model computed with the "far" package (see "Null 1"). Under the alternative of causality, we tested five different scenarios. We simulated with ρ on a sinusoidal basis that approximates the Hilbert space H. In fact, we used the function "theoretical.coef" (package "far") to obtain the parameters used internaly by the function "simul.farx" (package "far") to make the simulation. Table 1 presents the different forms for ρ.  The first scenario "Null 1" is used in the last line (line 4) of Table 2 of the level. Here, we represent the space H by the space H m × H m . H m is the space of Y t and H m for X t . Then, it can have more than two lines to represent ρ, depending on the dimension of approximations of the two spaces H m and H m . For example, if we take dim(H m ) = 3 and dim(H m ) = 2 (as in the first scenario) with a basis with two components, then in the case of scenario 1, we have the following approximations:  Figure 3 represents the whole trajectory of a functional time series simulated with sample size of 100. Figure 4 is the same as Figure 3 but we bring back the sequence series to the same time domain. Figure 5 plots the whole trajectory of two functional time series, which are in a causal relation.

Results
We present the type I error (power, respectively) in Table 2 (Table 3, respectively) for each different considered scenario. We make a replication of order 1000 for each scenario. Then, we count the number of rejections of the Null hypothesis, which in the case of a true Null hypothesis gives an approximation of the type I error and in the case of false Null hypothesis gives an approximation of the power of the test (which is 1 − β where β is the type II error).
In Table 2, we see that the nominal level 0.05 is very well respected for the F-causality and Dynamic-FPCA tests and for different values of n. The parameter p of the classical test has to be well tuned, and there are many variations for this parameter. However, for p = 3 and only its value in the different simulation setup, the classical test reaches the nominal level correctly.
In Table 3, we perform the test for the different scenarios with parameters n = 100 or 200, m = 50 and K = 1 to 6. We observe, in general, that the power is sufficiently high for the five different models. The sample size plays a role in the power. Higher is the sample size, the better is the power of the test. With n = 200, the power is sufficient. We can also see the influence of the parameter K. We also note that if K is badly selected, then there can be a lack of power, as we can see in model 3, for example.

Comparison of the Three Tests
Since the nominal level is well respected for the two first tests, it seems that the second test Dynamic-FPCA is more powerful than the two other tests in all the scenarios except for model 1. We can explain this by observing that the Dynamic-FPCA captures the properties of functional time series more, as shown in [17]. To understand the fact that model 1 is better for the F-causality test, we can say the departure from the null hypothesis is weak, as ρ 12 is nearly zero.
As the classical test does not reach the level of significance, and the Dynamic-FPCA seems more powerful than the F-causality test, we recommend that the Dynamic FPCA test is performed.

Real Data Illustration
The dataset we used is available in the R package "fds" [22] and is already studied in [23]. The article [23] deals with the electricity demands and the temperature in Adelaide. This dataset consists of half-hourly electricity demands in Adelaide and temperatures measured at the Adelaide airport from Sunday to Saturday between 6 July 1997 and 31 March 2007 (see Figure 6 for the electricity demand on Thursday and Figure 7 for the temperature on Thursday).  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.

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.

Results of the Classical Algorithm
In order to compare, we also performed the classical test (Table 6) with the p-values. There is a major drawback to performing a classical test, namely non-stationarity. In fact, the functional analysis allows us to perform the test directly on the functional series, which can be directly seen as stationary functional series. In the classical setting, we must differentiate the fourteen series at lag 48 to remove the seasonal components. We chose to differentiate the series at lag 48 because of the recording of the series. In fact, the series is recorded every half hour in a day. Therefore, we chose to differentiate at lag 2 × 24. Furthermore, we chose to fix p at 3, as it seems to perform at this value in the simulations. The same conclusion for each day holds for the classical test as the Dynamic-FPCA test.

Conclusions
Causality is a hard notion due to the lack of universal definition. One notion of linear causality for functional data was proposed and studied. We have proposed three statistical procedures to test this concept in a special case, i.e., the autoregressive model of order 1. A mathematical study of the behavior of the testing procedures would be an interesting future work. Extensions to more general models will be also considered in future work. The performance of the proposed testing procedures shows good behavior in simulations. The simulation study shows different behaviors between classical test, F-causality test and the Dynamic-FPCA test. An application to the electricity demands and the temperature is studied in detail. Finally, we can conclude that the dynamic FPCA algorithm is more suitable for the causality test due to its effectiveness to measure the causality with precision. Possible alternatives to the test of Zhang and Shao would be to perform a global F-test as in [24] or to test the effect of the variable X on errors as [25]. Another possible extension is to study the link between the shape through the phase and amplitude variation in functional data [2] and causality.