Next Article in Journal
Revisiting Structural Breaks in the Terms of Trade of Primary Commodities (1900–2020)—Markov Switching Models and Finite Mixture Distributions
Previous Article in Journal
Rényi Transfer Entropy Estimators for Financial Time Series
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Proceeding Paper

Kernel Two-Sample and Independence Tests for Nonstationary Random Processes †

by
Felix Laumann
1,*,
Julius von Kügelgen
2,3 and
Mauricio Barahona
1
1
Department of Mathematics, Imperial College London, London SW7 2AZ, UK
2
MPI for Intelligent Systems, Max-Planck-Ring 4, 72076 Tübingen, Germany
3
Department of Engineering, University of Cambridge, Cambridge CB2 1TN, UK
*
Author to whom correspondence should be addressed.
Presented at the 7th International Conference on Time Series and Forecasting, Gran Canaria, Spain, 19–21 July 2021.
Eng. Proc. 2021, 5(1), 31; https://doi.org/10.3390/engproc2021005031
Published: 30 June 2021
(This article belongs to the Proceedings of The 7th International Conference on Time Series and Forecasting)

Abstract

:
Two-sample and independence tests with the kernel-based mmd and hsic have shown remarkable results on i.i.d. data and stationary random processes. However, these statistics are not directly applicable to nonstationary random processes, a prevalent form of data in many scientific disciplines. In this work, we extend the application of mmd and hsic to nonstationary settings by assuming access to independent realisations of the underlying random process. These realisations—in the form of nonstationary time-series measured on the same temporal grid—can then be viewed as i.i.d. samples from a multivariate probability distribution, to which mmd and hsic can be applied. We further show how to choose suitable kernels over these high-dimensional spaces by maximising the estimated test power with respect to the kernel hyperparameters. In experiments on synthetic data, we demonstrate superior performance of our proposed approaches in terms of test power when compared to current state-of-the-art functional or multivariate two-sample and independence tests. Finally, we employ our methods on a real socioeconomic dataset as an example application.

1. Introduction

Nonstationary processes are the rule rather than the exception in many scientific disciplines such as epidemiology, biology, sociology, economics, or finance. In recent years, there has been a surge of interest in the analysis of problems described by large sets of interrelated variables with few observations over time, often involving complex nonlinear and nonstationary behaviours. Examples of such problems include the longitudinal spread of obesity in social networks [1], disease modelling from time-varying inter- and intracellular relationships [2], behavioural responses to losses of loved ones within social groups [3], and the linkage between climate change and the global financial system [4]. All such analyses rely on the statistical assessment of the similarity between, or the relationship amongst, noisy time series that exhibit temporal memory. Therefore, the ability to test the statistical significance of homogeneity and dependence between random processes that cannot be assumed to be independent and identically distributed (i.i.d.) is of fundamental importance in many fields.
Kernel-based methods provide a popular framework for homogeneity and independence tests by embedding probability distributions in rkhs [5] (Section 2.2). Of particular interest are the kernel-based two-sample statistic mmd (mmd) [6], which is used to assess whether two samples were drawn from the same distribution, hence testing for homogeneity; and the related hsic (hsic) [7], which is used to assess dependence between two random variables, thus testing for independence. These methods are nonparametric, i.e., they do not make any assumptions on the underlying distribution or the type of dependence. However, in their original form, both mmd and hsic assume access to a sample of i.i.d. observations—an assumption that is often violated for temporally-dependent data such as random processes.
Extensions of mmd and hsic to random processes have been proposed [8,9]. Yet, these methods require the random process to be stationary, meaning that its distribution does not change over time. While it is sometimes possible to approximately achieve stationarity with preprocessing techniques such as (seasonal) differencing or square root and power transformations, such approaches become cumbersome and notoriously difficult, particularly with large sets of variables. The stationarity assumption can therefore pose severe limitations in many application areas where multiple nonstationary processes must be taken into consideration. When studying the relationships of climate change to the global financial system, for example, factors such as greenhouse gas emissions, stock market indices, government spending, and corporate profits would have to be transformed or assumed to be stationary over time.
In this paper, we show how the kernel-based statistics mmd and hsic can be applied to nonstationary random processes. At the heart of our proposed approach is the simple, yet effective idea that realisations of a random process in the form of temporally-dependent measurements (i.e., the observed time series) can be viewed as independent samples from a multivariate probability distribution, provided that they are observed at the same points in time, i.e., over the same temporal grid. Then, mmd and hsic can be applied on these distributions to test for homogeneity and independence, respectively.
The remainder of this paper is structured as follows. After discussing related work in Section 2, we introduce our applications of two-sample and independence testing with mmd and hsic to nonstationary random processes in Section 3. We then carry out experiments on multiple synthetic datasets in Section 4 and demonstrate that the proposed tests have higher power compared with current functional or multivariate two-sample and independence tests under the same conditions. We provide an example application of our proposed methods to a socioeconomic dataset in Section 5 and conclude the paper with a brief discussion in Section 6.

2. Related Work

Two-sample and independence tests on stochastic processes have been widely studied in recent years. Under the stationarity assumption, ref. [8] investigate how the kernel cross-spectral density operator may be used to test for independence, and [9] formulate a wild bootstrap-based approach for both two-sample and independence tests, which outperforms [8] in various experiments. The wild bootstrap in [9] approximates the null hypothesis H 0 by assuming there exists a time lag τ such that a pair of measurements at any point in time t, ( x i , y i ) t , is independent of ( x i , y i ) t ± s for s τ . This method is applicable to test for instantaneous homogeneity and independence in stationary processes but requires further assumptions to investigate noninstantaneous cases: a maximum lag M τ must be defined as the largest absolute lag for the test. This results in multiple hypothesis testing requiring adjustment by a Bonferroni correction. Further, ref. [10] have applied distance correlation [11], a hsic-related statistic, to independence testing on stationary random processes.
Beyond the stationarity assumption, two-sample testing in the functional data analysis literature has mostly focused on differences of mean [12] or covariance structures [13,14]. However, ref. [15] have developed a two-sample test for distributions based on generalisations of a finite-dimensional test by utilising functional principal component analysis, and [16] have derived kernels over functions to be used with mmd for the two-sample test. Independence testing for functional data using kernels was recently proposed in [17] but assumes the samples lie on a finite-dimensional subspace of the function space—an assumption not required in our work. Moreover, ref. [18] have developed computationally efficient methods to test for independence on high-dimensional distributions and large sample sizes by using eigenvalues of centred kernel matrices to approximate the distribution under the null hypothesis H 0 instead of simulating a large number of permutations.

3. mmd and hsic for Nonstationary Random Processes

3.1. Notation and Assumptions

Let { X t } and { Y t } denote two nonstationary stochastic processes with probability laws P X and P Y , respectively. We assume that we observe m independent realisations of { X t } and n independent realisations of { Y t } in the form of time series measured at T X and T Y time points, respectively. Said differently, the data samples X = { x i } i = 1 m i . i . d . P X are a set of nonstationary time series, x i = { x i , 1 , , x i , T X } , arriving over the same temporal grid, and similarly for Y = { y i } i = 1 n i . i . d . P Y with y i = { y i , 1 , , y i , T Y } . Note that the measurements x i , t and y i , t are not independent across time (we use the terms ‘sample’ and ‘realisation’ interchangeably to denote x i and y i and the term ’measurement’ to denote the temporally dependent vectors x i , t and y i , t ).
We may view the realisations x i and y i as samples of multivariate probability distributions of dimension T X and T Y , respectively, which are independent at any given point in time, i.e., x i , t x j , t and y i , t y j , t t and i j . Consequently, we can represent these distributions by their mean embeddings μ X and μ Y in reproducing kernel Hilbert space (rkhss) and use these to conduct kernel-based two-sample and independence tests. Given a characteristic kernel k, i.e., the mean embedding μ captures all information of a distribution P [19], the dependence between measurements in time is captured by the ordering of the variables, and the fact that any characteristic kernel k is injective, thus guaranteeing a unique mapping of any probability distribution into a rkhs [20].
For homogeneity testing ( P X = ? P Y ), we use the kernel-based mmd statistic and require equal number of measurements T = T X = T Y but allow different sample sizes, m n . For independence testing ( P X Y = ? P X P Y ), we employ the related hsic, and in this case number of measurements can differ, but we require the same number of realisations, m = n . We now describe how two-sample and independence tests can be performed under these assumptions.

3.2. mmd for Nonstationary Random Processes

Let k : R T × R T R be a characteristic kernel, such as the Gaussian kernel k ( x , y ) = exp ( x y 2 / σ 2 ) , which uniquely maps P X and P Y to their associated rkhs H k via the mean embeddings μ X : = k ( x , · ) d P X ( x ) and μ Y : = k ( y , · ) d P Y ( y ) [5] (Section 2.1). The mmd between P X and P Y in H k is defined as [6]:
MMD 2 ( H k , P X , P Y ) : = μ X μ Y H k 2 0 , with equality iff P X = P Y .
Given samples X and Y , MMD 2 ( H k , P X , P Y ) can then be approximated by the following unbiased estimator [6]:
MMD ^ u 2 ( H k , X , Y ) = i = 1 m j i m k ( x i , x j ) m ( m 1 ) + i = 1 n j i n k ( y i , y j ) n ( n 1 ) 2 i = 1 m j = 1 n k ( x i , y j ) m n .
Henceforth, we drop the implied H k for ease of notation.
Using MMD ^ u 2 ( X , Y ) as a test statistic, one can construct a statistical two-sample test for the null hypothesis H 0 : P X = P Y against the alternative hypothesis H 1 : P X P Y [21].
Let α be the significance level of the test, i.e., the maximum allowable probability of falsely rejecting H 0 and hence an upper bound on the type-I error. Given α , the threshold c α for the test statistic can be approximated with a permutation test as follows. We first generate P randomly permuted partitions of the set of all realisations X Y with sizes commensurate with ( X , Y ) , denoted ( X p , Y p ) , p = 1 , , P . We then compute MMD ^ u 2 ( X p , Y p ) , p , and sort the results in descending order. Finally, we select the statistic at position ( 1 α ) × P as our empirical threshold c ^ α . The null hypothesis H 0 is then rejected if MMD ^ u 2 ( X , Y ) > c ^ α . For a computationally less expensive (but generally less accurate) option, the inverse cumulative density function of the Gamma distribution can be computed to approximate the null distribution [22].

3.3. hsic for Nonstationary Random Processes

Let P X Y denote the joint distribution of { X t } and { Y t } , and let H k and G l be separable rkhss with characteristic kernels k : R T X × R T X R and l : R T Y × R T Y R , respectively. hsic is then defined as the mmd between P X Y and P X P Y [7]:
HSIC ( H k , G l , P X Y ) : = MMD 2 ( k l , P X Y , P X P Y ) = μ X Y μ X μ Y k l 2 0 , with equality iff P X Y = P Y P Y .
Here, ⊗ denotes the tensor product. Recall that we assume an equal number of realisations m for both processes, and let K , L R m × m be the kernel matrices with entries k i j = k ( x i , x j ) and l i j = l ( y i , y j ) , respectively. Given i.i.d. samples ( X , Y ) , an unbiased empirical estimator of HSIC ( H k , G l , P X Y ) is given by [23] (Theorem 2):
HSIC ^ u ( H k , G l , X Y ) = 1 m ( m 3 ) trace ( K ˜ L ˜ ) + 1 K ˜ 1 1 L ˜ 1 ( m 1 ) ( m 2 ) 2 m 2 1 K ˜ L ˜ 1 ,
where K ˜ = K diag ( K ) and L ˜ = L diag ( L ) , and 1 is the m × 1 vector of ones. To ease our notation, we henceforth omit the implied H k and G l .
To test HSIC ^ u ( X Y ) for statistical significance, we define the null hypothesis H 0 : P X Y = P X P Y and the alternative H 1 : P X Y P X P Y . We broadly repeat the procedure outlined in Section 3.2 by bootstrapping the distribution under H 0 via permutations, with the distinction that we only permute the samples { y i } i = 1 m , resulting in Y p , p [ 1 , P ] , whilst the { x j } j = 1 m are kept unchanged [7]. HSIC ^ u ( X Y ) is then computed for each permutation ( X , Y p ) and the empirical threshold c ^ α is taken as the statistic at position ( 1 α ) × P . The null hypothesis H 0 is rejected, if HSIC ^ u ( X Y ) > c ^ α .

3.4. Maximising the Test Power

The power of both mmd-based two-sample and hsic-based independence tests is prone to decay in high dimensional spaces [24,25], as in our setting where each measurement point in time is treated as a separate dimension. Hence, we describe here how a kernel k can be chosen to maximise the test power, i.e., the probability of correctly rejecting H 0 given that it is false. First, note that under H 1 both MMD ^ u 2 ( X , Y ) [21] (Corollary 16) and HSIC ^ u ( X Y ) [7] (Theorem 1) are asymptotically Gaussian:
MMD ^ u 2 ( X , Y ) MMD 2 ( P X , P Y ) V m MMD ( P X , P Y ) D N ( 0 , 1 )
HSIC ^ u ( X Y ) HSIC ( P X Y ) V m HSIC ( P X Y ) D N ( 0 , 1 ) ,
where V m MMD ( P X , P Y ) and V m HSIC ( P X Y ) denote the asymptotic variance of MMD ^ u 2 ( X , Y ) and HSIC ^ u ( X Y ) , respectively [26] (Section 5.5.1 (A)).
Given a significance level α , we define the test thresholds c α MMD and c α HSIC and reject H 0 if MMD ^ u 2 ( X , Y ) > c α MMD or HSIC ^ u ( X Y ) > c α HSIC . Following [27], the test power is defined in terms of P 1 , the distributions under H 1 , with equal sample sizes m = n as:
P 1 MMD ^ u 2 ( X , Y ) > c ^ α MMD m D Φ MMD 2 ( P X , P Y ) c α MMD / m V m MMD ( P X , P Y )
P 1 HSIC ^ u ( X Y ) > c ^ α HSIC m D Φ HSIC ( P X Y ) c α HSIC / m V m HSIC ( P X Y ) ,
where Φ is the cumulative density function of the standard Gaussian distribution and where c ^ α c α with increasing sample size. To maximise the test power, we maximise the argument of Φ , which we approximate by maximising MMD ^ u 2 ( X , Y ) / V ^ m MMD ( X , Y ) and minimising c ^ α MMD / m V ^ m MMD ( X , Y ) for (7), and similarly for (8). The empirical unbiased variance V ^ m MMD ( X , Y ) in (7) was derived in [27], and we use [23] (Theorem 5) for V ^ m HSIC ( X Y ) in (8).
We perform this optimisation by splitting our samples ( X , Y ) into training and testing sets, of which we take the former to learn the kernel hyperparameters and the latter to conduct the final hypothesis test with the learnt kernel.

4. Experimental Results on Synthetic Data

To evaluate our proposed tests empirically, we first apply our homogeneity and independence tests to various nonstationary synthetic datasets. We report test performance using μ ^ , the percentage of rejection of the null hypothesis H 0 , which becomes the test power once H 0 is false, by repeating the experiments on 200 trials (i.e., 200 independently generated synthetic datasets). We provide 95 % confidence intervals computed as μ ^ ± 1.96 μ ^ ( 1 μ ^ ) / 200 .

4.1. Homogeneity Tests with mmd

4.1.1. Setup

We evaluate our mmd-based homogeneity test against shifts in mean and variance of two nonstationary stochastic processes { X t } and { Y t } by establishing if they are correctly accepted or rejected under the null hypothesis H 0 : P X = P Y . For ease of comparison, we adopt the experimental protocol of [15] and consider two stochastic processes based on a linear mixed effects model. We generate independent samples X = { x i } i = 1 m and Y = { y i } i = 1 n on an equally spaced temporal grid of length T X = T Y = T in the interval I = [ 0 , 1 ] ,
x i , t = μ X ( t ) + k = 1 K ξ X i , k ϕ k ( t ) + ϵ X i , t and y i , t = μ Y ( t ) + k = 1 K ξ Y i , k ϕ k ( t ) + ϵ Y i , t ,
where we set K = 2 with Fourier basis functions ϕ 1 ( t ) = 2 sin ( 2 π t ) and ϕ 2 ( t ) = 2 cos ( 2 π t ) . The coefficients ξ X i , k and ξ Y i , k and the additive noises ϵ X i , t , ϵ Y i , t are all independent Gaussian-distributed random variables with means and variances specified below.
We evaluate the test power against varying values of shifts in mean and variance as follows:
  • Mean shift: μ X ( t ) = t and μ Y ( t ) = t + δ μ t 3 . The basis coefficients are sampled as ξ X i , 1 , ξ Y i , 1 N ( 0 , 10 ) and ξ X i , 2 , ξ Y i , 2 N ( 0 , 5 ) , and the additive noises are sampled as ϵ X i , t , ϵ Y i , t N ( 0 , 0.25 ) .
  • Variance shift: We take μ X ( t ) = μ Y ( t ) = 0 , and introduce a shift in variance in the first basis function coefficients via ξ X i , 1 N ( 0 , 10 ) and ξ Y i , 1 N ( 0 , 10 + δ σ ) . The second coefficients are sampled as ξ X i , 2 , ξ Y i , 2 N ( 0 , 5 ) , and the noises as ϵ X i , t , ϵ Y i , t N ( 0 , 0.25 ) .
The coefficients δ μ and δ σ for mean and variance shifts, respectively, determine the departure from the null hypothesis. Setting δ μ , δ σ = 0 means H 0 is true, whereas δ μ , δ σ > 0 means H 0 is false. Although this is not a necessity, we set the number of independent samples of { X t } and { Y t } to be equal, m = n . To test for statistical significance, we follow the procedure described in Section 3.2 and perform permutation tests of P = 5000 partitions for varying values of δ μ and δ σ and different sample sizes m = 100 , 200 , 300 , 500 .

4.1.2. Baseline Results without Test Power Optimisation

Our baseline results are obtained with a Gaussian kernel k ( x , y ) = exp ( x y 2 / σ 2 ) with bandwidth σ equal to the median distance between observations of the aggregated samples. Figure 1 shows how our method (solid lines) compares to [15] (dashed lines) for T = 100 discrete time points. For all sample sizes, the type-I error rate lies at or below the allowable probability of false rejection α , and our method significantly outperforms [15] for nearly all levels of mean and variance shifts. Both shifts become easier to detect for larger sample sizes. Particularly strong improvements are achieved for mean shifts: our method makes no type-II errors for δ μ 3 on m = 100 samples, whereas [15] only reach such performance with m = 500 samples and δ μ 4.5 . We obtain similar test power results (see Appendix A.1) for coarser realisations with T = 5 , 10 , 25 , 50 over the same interval I = [ 0 , 1 ] .

4.1.3. Results of the Optimised Test

Next, we apply the method described in Section 3.4 to maximise the test power. Specifically, we search for the Gaussian kernel bandwidth σ (over spaces defined in Table A1 in Appendix A.2), that maximises the argument of Φ in our approximations of (7) on our training samples. For demonstrative purposes, we choose to split our dataset equally into training and testing sets although other ratios may lead to higher test power. Figure 2 shows the results of the optimised test (dotted lines) against the baseline results (solid lines) and the results of [15] (dashed lines) for m = 100 and m = 200 samples and T = 100 discrete points in time. We find that the test power is significantly improved by our optimisation for the detection of mean shifts. For instance, test power rises fourfold for δ μ = 1 and m = 200 compared to our baseline method. Furthermore, we have no type-II errors once δ μ 2 for m = 100 , as compared to δ μ 3 for our baseline test and δ μ 6.5 for [15]. In its current form, however, our optimisation does not yield higher test power for the detection of variance shifts, a fact that we discuss in Section 6.

4.2. Independence Tests with hsic

4.2.1. Setup

To test for independence, the null hypothesis is H 0 : P XY = P X P Y . We assume we observe measurements x i , t and y i , t over temporal grids of length T X and T Y in the interval I = [ 0 , 1 ] , respectively. To measure type-I and type-II error rates, we use the following experimental protocols, partly adopted from [7,18,28]:
  • Linear dependence: X is generated as in (9) with μ X ( t ) = t , basis coefficients ξ X i , 1 N ( 0 , 10 ) , ξ X i , 2 N ( 0 , 5 ) , and noise ϵ X i , t N ( 0 , 0.25 ) . The samples of the second process are Y = { x i , 1 + ϵ i } i = 1 m where ϵ i N ( 0 , 1 ) , as in [18].
  • Dependence through a shared coefficient: X and Y are generated as in (9) with μ X ( t ) = μ Y ( t ) = t and independently sampled ξ X i , 1 , ξ Y i , 1 , ϵ X i , t , ϵ Y i , t as in the mean shift experiments of Section 4.1, but where the stochastic processes now share the second basis function coefficient: ξ X i , 2 = ξ Y i , 2 .
  • Dependence through rotation: We start by generating independent X ( 0 ) and Y ( 0 ) as in (9) with μ X ( t ) = μ Y ( t ) = t and ϵ X i , t , ϵ Y i , t N ( 0 , 0.25 ) , but with ξ X i , k and ξ Y i , k drawn from: (i) student-t, (ii) uniform, or (iii) exponential distributions [28] (Table 3). We next multiply ( X ( 0 ) , Y ( 0 ) ) by a 2 × 2 rotation matrix R ( θ ) with θ [ 0 , π / 4 ] to generate new rotated samples ( X , Y ) , which we then test for independence. Clearly, for θ = 0 our samples ( X , Y ) are independent and as θ is increased their dependence becomes easier to detect (see [7] (Section 4) and Figure A3 for implementation details).
Statistical significance is computed using P = 5000 permutations of Y whilst X is kept fixed to approximate the distribution under H 0 . Test power is calculated for varying T = [ 5 , 10 , 25 , 50 , 100 ] and different sample sizes m = n .

4.2.2. Baseline Results without Test Power Optimisation

Our baseline results are computed using a Gaussian kernel with σ equal to the median distance between measurements in the corresponding sample. Figure 3 (left) shows the results of our test on the linear dependence experiments, which demonstrate, due to T Y = 1 , how dependencies between individual points in time and an entire time series can be detected. We compare our method to: (i) a statistic explicitly aimed at linear dependence, SubCorr = 1 T X t = 1 T X Corr ( { x i , t } i = 1 m , Y ) , where Corr ( · , · ) is the Pearson correlation coefficient; and (ii) SubHSIC = 1 T X t = 1 T X HSIC ^ u ( { x i , t } i = 1 m , Y ) . For both of these methods, the distribution under H 0 is also approximated via permutations. We find that SubCorr outperforms the other methods in experiments with sample sizes m < 20 , and SubHSIC achieves comparable results to our method. The results for T X = [ 25 , 50 , 100 ] (see Appendix A.1) are similar.
Figure 3 (right) displays the power of our independence test for the case of dependent samples through a shared coefficient for varying sample sizes m and measurements T. We compare our results to two spectral methods [18] that approximate the distribution under H 0 using eigenvalues of the centred kernel matrices of X and Y : spectral hsic uses the unbiased estimator (4) as the test statistic with the eigenvalue-based null distribution; and spectral rff uses a test statistic induced by a number of random Fourier feature (rffs) (set here to 10) that approximate the kernel matrices of X and Y . Our method and spectral hsic achieve 20 50 % improvement in test power compared to spectral rff. For small numbers of samples ( m < 15 ), our method outperforms spectral hsic, which converges to the performance of our method with increasing sample size, as we would expect it [22] (Theorem 1).
Figure 4 shows the rotation dependence experiments, where θ = 0 corresponds to the null hypothesis (independence) and θ > 0 to the alternative. The distribution hyperparameters for ξ X i , k and ξ Y i , k are detailed in Appendix A.3, and we set T X = T Y = T , although equality is not required. As expected, dependence is easier to detect with increasing θ . We observe that denser temporal measurements do not result in enhanced test power. Note that the test power is highly dependent on the distribution of the coefficients of the basis functions ξ X i , k , ξ Y i , k .

4.2.3. Results of the Optimised Test

The test power maximisation was applied to the rotation dependence experiments by searching for optimal Gaussian kernel bandwidths σ X and σ Y over predefined intervals (specified in Appendix A.2). Figure 4 shows that the test power is improved when the basis function coefficients are drawn from uniform distributions. In this case, the percentage of rejected H 0 is 20 40 % higher for θ between 0.2 and 0.75 × π / 4 , but it levels off at 95 % once θ 0.75 × π / 4 , which is the same level achieved by our baseline method for θ 0.85 × π / 4 . With our current test-train split, our optimised test does not improve the test power if the basis function coefficients ξ X i , k and ξ Y i , k are drawn from student-t or exponential distributions.

5. Application to a Socioeconomic Dataset

As a further illustration, we apply our method to the United Nations’ socioeconomic Sustainable Development Goal (sdgs) (see Appendix A.4 for details). Specifically, we investigate whether some so-called Targets of the 17 sdgs have been homogeneous over the last 20 years across low- and high-income countries and whether certain sdgs in African countries exhibit dependence over the same period. In both settings, we assume countries are independent.
For our homogeneity tests, we classify countries into low- and high-income according to [29]. We use temporal data of 76 Targets for which [30] provides data collected over the last T = 20 years for m = 30 low-income countries and n = 55 high-income countries. Applying our baseline method without test power optimisation, we find that, out of the 76 Targets we have data available for, only 38 have had homogeneous trajectories in low- and high-income countries. For instance, whereas the ‘death rate due to road traffic injuries’ (Target 3.6) has been homogeneous between these two groups, the ‘fight the epidemics of AIDS, tuberculosis, malaria and others’ (Target 3.3) has not been homogeneous in low- and high-income countries.
For our independence tests, we consider temporal data from m = n = 49 African countries over T = 20 years and test any two Targets for pairwise independence. Of the total 2850 possible pairwise combinations, the null hypothesis of independence is rejected for 357. As an illustration, we examine the dependencies of ‘implementation of national social protection systems’ (Target 1.3) with ‘economic growth’ (Target 8.1) and the ‘proportion of informally employed workers’ (Target 8.3). Applying our baseline method, we accept the null hypothesis of independence between Target 1.3 and 8.1, i.e., we find that the ‘implementation of national social protection systems’ has been independent of economic growth. In contrast, we find that Target 1.3 has been dependent on the ‘proportion of informally employed workers’ (Target 8.3).

6. Discussion and Conclusions

Building on ideas from functional data analysis, we have presented approaches to testing for homogeneity and independence between two nonstationary random processes with the kernel-based statistics mmd and hsic. We view independent realisations of the underlying processes as samples from multivariate probability distributions to which mmd and hsic can be applied. Our tests are shown to outperform current state-of-the-art methods in a range of experiments. Furthermore, we optimise the test power over the choice of kernel and achieve improved results in most settings. However, we also observe that our optimisation procedure does not always yield an increase in test power. We leave the investigation of this behaviour open for future research with the possibility of defining search spaces and step sizes over kernel hyperparameters differently or of choosing a gradient-based approach for optimisation [27]. Our results show that small sample sizes of less than 40 independent realisations can already achieve high test power and that denser measurements over the same time period do not necessarily lead to enhanced test power.
The proposed tests can be of interest in many areas where nonstationary and nonlinear multivariate temporal datasets constitute the norm, as illustrated by our application to test for homogeneity and independence between the United Nations’ Sustainable Development Goals measured in different countries over the last 20 years.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The socioeconomic dataset is freely available at [30].

Appendix A

Appendix A.1. Results for Realisations with Varying Number of Time Points, T

mmd We show here the results for mean and variance shifts for m = n = 100 , but the results are similar for all tested sample sizes m = n = 100 , 200 , 300 , 500 ,
Figure A1. Results of mmd-based homogeneity test with T = [ 5 , 10 , 25 , 50 , 100 ] : Percentage of rejected H 0 for mean shift (left) and variance shift (right) for sample sizes m = n = 100 and T discrete time points in d = 1 dimensions.
Figure A1. Results of mmd-based homogeneity test with T = [ 5 , 10 , 25 , 50 , 100 ] : Percentage of rejected H 0 for mean shift (left) and variance shift (right) for sample sizes m = n = 100 and T discrete time points in d = 1 dimensions.
Engproc 05 00031 g0a1
hsic Experiments for linear dependence and dependence through shared second basis function coefficient for various T. We find that the granularity of measurements over time does not influence the text power significantly.
Figure A2. Results of the hsic-based independence test: Test power for linear dependence (left) and dependence through shared coefficient (right) as sample size is varied for various numbers of time points T = [ 5 , 10 , 25 , 50 , 100 ] .
Figure A2. Results of the hsic-based independence test: Test power for linear dependence (left) and dependence through shared coefficient (right) as sample size is varied for various numbers of time points T = [ 5 , 10 , 25 , 50 , 100 ] .
Engproc 05 00031 g0a2

Appendix A.2. Test Power Maximisation

mmd For mean shift experiments for mmd, we predefine a linear search space with 11 values for the Gaussian kernel bandwidth σ due to the dependence on δ μ and similarly for variance shift experiments (both stated in Table A1). These search spaces resulted from extensive manual explorations for all shifts and sample sizes. We acknowledge that the test power may be further improved with search spaces of finer granularity.
hsic We define search intervals of both σ X and σ Y across all angles θ but different for the student-t, uniform, and exponential distributions. For student-t and exponential distributions, both σ X and σ Y were chosen as 20 evenly spaced numbers on a linear scale between 1 and 20. For uniform distributions, both σ X and σ Y were chosen as 40 evenly spaced numbers on a linear scale between 1 and 40. These search spaces resulted from extensive manual explorations for all angles and distributions. We acknowledge that the test power may be further improved with search spaces of finer granularity.
Table A1. Linear search spaces for bandwidth σ in mmd mean (left) and variance (right) shift experiments.
Table A1. Linear search spaces for bandwidth σ in mmd mean (left) and variance (right) shift experiments.
δ μ 0–22.25–33.25–55.5–8 δ σ 0–45–1415–32
Step Size = 0.25Step Size = 0.5 Step Size = 1
search space for σ 161116search space for σ 102030
381318122232
5101520142434
7121722162636
9141924182838
11162126203040
13182328223242
15202530243444
17222732263646
19242934283848
21263136304050

Appendix A.3. Distribution Specifications for Basis Function Coefficients in Rotation Mixing

Table A2. Specifications of distributions for the rotation mixing. They are a subset of the distributions in [28] (Table 3), and Z is a proxy for both X and Y .
Table A2. Specifications of distributions for the rotation mixing. They are a subset of the distributions in [28] (Table 3), and Z is a proxy for both X and Y .
DistributionFourier Basis Function Coefficients
ξ Z i 1 ξ Z i 2
Exponential λ = 1.5 λ = 3
Student-t ν = 3 ν = 5
Uniform U [ 10 , 10 ] U [ 5 , 5 ]
Figure A3. Illustration of X and Y with (i) student-t, (ii) uniform, and (iii) exponential basis function coefficients being mixed by different rotation angles θ , ordered clockwise by increasing θ .
Figure A3. Illustration of X and Y with (i) student-t, (ii) uniform, and (iii) exponential basis function coefficients being mixed by different rotation angles θ , ordered clockwise by increasing θ .
Engproc 05 00031 g0a3

Appendix A.4. SDG Dataset

Data of the Indicators measuring the progress of the Targets of the sdgs can be found at [30]. Each of these Indicators measures the progress towards a specific Target. For instance, an Indicator for Target 1.1, ‘by 2030, eradicate extreme poverty for all people everywhere, currently measured as people living on less than $1.90 a day’, is the ‘proportion of population below the international poverty line, by gender, age, employment status and geographical location (urban/rural)’. Each of the Targets belongs to one specific Goal (e.g., Target 1.1 belongs to Goal 1, ‘end poverty in all its forms everywhere’). There are 17 such Goals, which are commonly referred to as the Sustainable Development Goals (sdgs). We compute averages over all Indicators belonging to one Target for our analyses in Section 5.
The dataset of [30] has many missing values, especially for the time span 2000–2005. We impute these values using a weighted average across countries (where data is available) with weights inversely proportional to the Euclidean distance between indicators.

References

  1. Christakis, N.A.; Fowler, J.H. The spread of obesity in a large social network over 32 years. N. Engl. J. Med. 2007, 357, 370–379. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  2. Barabási, A.L.; Gulbahce, N.; Loscalzo, J. Network medicine: A network-based approach to human disease. Nat. Rev. Genet. 2011, 12, 56–68. [Google Scholar] [CrossRef] [Green Version]
  3. Bond, R. Complex networks: Network healing after loss. Nat. Hum. Behav. 2017, 1, 1–2. [Google Scholar] [CrossRef]
  4. Battiston, S.; Mandel, A.; Monasterolo, I.; Schütze, F.; Visentin, G. A climate stress-test of the financial system. Nat. Clim. Chang. 2017, 7, 283–288. [Google Scholar] [CrossRef]
  5. Muandet, K.; Fukumizu, K.; Sriperumbudur, B.; Schölkopf, B. Kernel mean embedding of distributions: A review and beyond. Found. Trends Mach. Learn. 2017, 10, 1–141. [Google Scholar] [CrossRef]
  6. Gretton, A.; Borgwardt, K.; Rasch, M.; Schölkopf, B.; Smola, A.J. A kernel method for the two-sample-problem. arXiv 2008, arXiv:0805.2368. [Google Scholar]
  7. Gretton, A.; Fukumizu, K.; Teo, C.H.; Song, L.; Schölkopf, B.; Smola, A.J. A kernel statistical test of independence. NIPS 2008, 20, 585–592. [Google Scholar]
  8. Besserve, M.; Logothetis, N.K.; Schölkopf, B. Statistical analysis of coupled time series with Kernel Cross-Spectral Density operators. In Advances in Neural Information Processing Systems 26; Curran Associates, Inc.: Red Hook, NY, USA, 2013; pp. 2535–2543. [Google Scholar]
  9. Chwialkowski, K.; Sejdinovic, D.; Gretton, A. A wild bootstrap for degenerate kernel tests. In Advances in Neural Information Processing Systems; Curran Associates, Inc.: Red Hook, NY, USA, 2014; pp. 3608–3616. [Google Scholar]
  10. Davis, R.A.; Matsui, M.; Mikosch, T.; Wan, P. Applications of distance correlation to time series. Bernoulli 2018, 24, 3087–3116. [Google Scholar] [CrossRef] [Green Version]
  11. Székely, G.J.; Rizzo, M.L.; Bakirov, N.K. Measuring and testing dependence by correlation of distances. Ann. Stat. 2007, 35, 2769–2794. [Google Scholar] [CrossRef]
  12. Horváth, L.; Kokoszka, P.; Reeder, R. Estimation of the mean of functional time series and a two-sample problem. J. R. Stat. Soc. Ser. B 2012, 75, 103–122. [Google Scholar] [CrossRef] [Green Version]
  13. Fremdt, S.; Steinbach, J.G.; Horváth, L.; Kokoszka, P. Testing the Equality of Covariance Operators in Functional Samples. Scand. J. Stat. 2012, 40, 138–152. [Google Scholar] [CrossRef] [Green Version]
  14. Panaretos, V.M.; Kraus, D.; Maddocks, J.H. Second-Order Comparison of Gaussian Random Functions and the Geometry of DNA Minicircles. J. Am. Stat. Assoc. 2010, 105, 670–682. [Google Scholar] [CrossRef] [Green Version]
  15. Pomann, G.M.; Staicu, A.M.; Ghosh, S. A two-sample distribution-free test for functional data with application to a diffusion tensor imaging study of multiple sclerosis. J. R. Stat. Soc. Ser. C 2016, 65, 395–414. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  16. Wynne, G.; Duncan, A.B. A kernel two-sample test for functional data. arXiv 2020, arXiv:2008.11095. [Google Scholar]
  17. Górecki, T.; Krzyśko, M.; Wołyński, W. Independence test and canonical correlation analysis based on the alignment between kernel matrices for multivariate functional data. Artif. Intell. Rev. 2018, 53, 475–499. [Google Scholar] [CrossRef] [Green Version]
  18. Zhang, Q.; Filippi, S.; Gretton, A.; Sejdinovic, D. Large-scale kernel methods for independence testing. Stat. Comput. 2018, 28, 113–130. [Google Scholar] [CrossRef] [Green Version]
  19. Sriperumbudur, B.K.; Gretton, A.; Fukumizu, K.; Schölkopf, B.; Lanckriet, G.R. Hilbert space embeddings and metrics on probability measures. J. Mach. Learn. Res. 2010, 11, 1517–1561. [Google Scholar]
  20. Sriperumbudur, B.K.; Fukumizu, K.; Lanckriet, G.R. Universality, Characteristic Kernels and RKHS Embedding of Measures. J. Mach. Learn. Res. 2011, 12, 2389–2410. [Google Scholar]
  21. Gretton, A.; Borgwardt, K.M.; Rasch, M.J.; Schölkopf, B.; Smola, A.J. A kernel two-sample test. J. Mach. Learn. Res. 2012, 13, 723–773. [Google Scholar]
  22. Gretton, A.; Fukumizu, K.; Harchaoui, Z.; Sriperumbudur, B.K. A fast, consistent kernel two-sample test. NIPS 2009, 23, 673–681. [Google Scholar]
  23. Song, L.; Smola, A.J.; Gretton, A.; Bedo, J.; Borgwardt, K. Feature selection via dependence maximization. J. Mach. Learn. Res. 2012, 13, 1393–1434. [Google Scholar]
  24. Ramdas, A.; Reddi, S.J.; Póczos, B.; Singh, A.; Wasserman, L. On the decreasing power of kernel and distance based nonparametric hypothesis tests in high dimensions. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, Austin, TX, USA, 25–30 January 2015. [Google Scholar]
  25. Reddi, S.; Ramdas, A.; Póczos, B.; Singh, A.; Wasserman, L. On the high dimensional power of a linear-time two sample test under mean-shift alternatives. Artif. Intell. Stat. 2015, 38, 772–780. [Google Scholar]
  26. Serfling, R.J. Approximation Theorems of Mathematical Statistics; Wiley Series in Probability and Mathematical Statistics; Wiley: New York, NY, USA, 2002. [Google Scholar]
  27. Sutherland, D.J.; Tung, H.Y.; Strathmann, H.; De, S.; Ramdas, A.; Smola, A.J.; Gretton, A. Generative models and model criticism via optimized maximum mean discrepancy. arXiv 2016, arXiv:1611.04488. [Google Scholar]
  28. Gretton, A.; Herbrich, R.; Smola, A.J.; Bousquet, O.; Schölkopf, B. Kernel methods for measuring independence. J. Mach. Learn. Res. 2005, 6, 2075–2129. [Google Scholar]
  29. World Bank. World Bank Country and Lending Groups. 2020. Available online: https://datahelpdesk.worldbank.org/knowledgebase/articles/906519-world-bank-country-and-lending-groups (accessed on 28 January 2020).
  30. World Bank. Sustainable Development Goals. 2020. Available online: https://datacatalog.worldbank.org/dataset/sustainable-development-goals (accessed on 28 January 2020).
Figure 1. Results of our mmd-based homogeneity test for nonstationary random processes: percentage of rejected H 0 as mean shift (left) and variance shift (right) are varied. Our baseline method (solid lines) is compared to [15] (dashed lines) for different sample sizes m = n = 100 , 200 , 300 , 500 and T = 100 discrete time points.
Figure 1. Results of our mmd-based homogeneity test for nonstationary random processes: percentage of rejected H 0 as mean shift (left) and variance shift (right) are varied. Our baseline method (solid lines) is compared to [15] (dashed lines) for different sample sizes m = n = 100 , 200 , 300 , 500 and T = 100 discrete time points.
Engproc 05 00031 g001
Figure 2. Results of homogeneity test with optimising for test power: percentage of rejected H 0 for mean shift (left) and variance shift (right) for sample sizes m = n = 100 , 200 and T = 100 discrete time points. Our optimised test power method (dotted lines) is compared to our baseline method (solid lines) and [15] (dashed lines).
Figure 2. Results of homogeneity test with optimising for test power: percentage of rejected H 0 for mean shift (left) and variance shift (right) for sample sizes m = n = 100 , 200 and T = 100 discrete time points. Our optimised test power method (dotted lines) is compared to our baseline method (solid lines) and [15] (dashed lines).
Engproc 05 00031 g002
Figure 3. Results of the hsic-based independence test: Test power for linear dependence (left) and dependence through shared coefficients (right) as sample size is varied for various numbers of time points. For the linear dependence, we compare our baseline results to SubCorr and SubHSIC; for the shared coefficient, we compare against two spectral approximations [18] (Section 5.1).
Figure 3. Results of the hsic-based independence test: Test power for linear dependence (left) and dependence through shared coefficients (right) as sample size is varied for various numbers of time points. For the linear dependence, we compare our baseline results to SubCorr and SubHSIC; for the shared coefficient, we compare against two spectral approximations [18] (Section 5.1).
Engproc 05 00031 g003
Figure 4. Results of the hsic-based independence test: Percentage of rejected H 0 in rotation dependence experiments for different number of discrete time points T and coefficients ξ X i , k and ξ Y i , k drawn from three distributions: (i) student-t, (ii) uniform, and (iii) exponential (see Appendix A.3). The sample size is m = 200 . The violet dotted lines are the results of our test power maximisation.
Figure 4. Results of the hsic-based independence test: Percentage of rejected H 0 in rotation dependence experiments for different number of discrete time points T and coefficients ξ X i , k and ξ Y i , k drawn from three distributions: (i) student-t, (ii) uniform, and (iii) exponential (see Appendix A.3). The sample size is m = 200 . The violet dotted lines are the results of our test power maximisation.
Engproc 05 00031 g004
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Laumann, F.; Kügelgen, J.v.; Barahona, M. Kernel Two-Sample and Independence Tests for Nonstationary Random Processes. Eng. Proc. 2021, 5, 31. https://doi.org/10.3390/engproc2021005031

AMA Style

Laumann F, Kügelgen Jv, Barahona M. Kernel Two-Sample and Independence Tests for Nonstationary Random Processes. Engineering Proceedings. 2021; 5(1):31. https://doi.org/10.3390/engproc2021005031

Chicago/Turabian Style

Laumann, Felix, Julius von Kügelgen, and Mauricio Barahona. 2021. "Kernel Two-Sample and Independence Tests for Nonstationary Random Processes" Engineering Proceedings 5, no. 1: 31. https://doi.org/10.3390/engproc2021005031

Article Metrics

Back to TopTop