Package 'dCovTS'

Title: Distance Covariance and Correlation for Time Series Analysis
Description: Computing and plotting the distance covariance and correlation function of a univariate or a multivariate time series. Both versions of biased and unbiased estimators of distance covariance and correlation are provided. Test statistics for testing pairwise independence are also implemented. Some data sets are also included. References include: a) Edelmann Dominic, Fokianos Konstantinos and Pitsillou Maria (2019). 'An Updated Literature Review of Distance Correlation and Its Applications to Time Series'. International Statistical Review, 87(2): 237--262. <doi:10.1111/insr.12294>. b) Fokianos Konstantinos and Pitsillou Maria (2018). 'Testing independence for multivariate time series via the auto-distance correlation matrix'. Biometrika, 105(2): 337--352. <doi:10.1093/biomet/asx082>. c) Fokianos Konstantinos and Pitsillou Maria (2017). 'Consistent testing for pairwise dependence in time series'. Technometrics, 59(2): 262--270. <doi:10.1080/00401706.2016.1156024>. d) Pitsillou Maria and Fokianos Konstantinos (2016). 'dCovTS: Distance Covariance/Correlation for Time Series'. R Journal, 8(2):324-340. <doi:10.32614/RJ-2016-049>.
Authors: Michail Tsagris [aut, cre], Maria Pitsillou [aut, cph], Konstantinos Fokianos [aut]
Maintainer: Michail Tsagris <[email protected]>
License: GPL (>= 2)
Version: 1.4
Built: 2024-12-21 06:27:55 UTC
Source: CRAN

Help Index


Distance Covariance and Correlation Theory for Time Series

Description

Computing and plotting the distance covariance and correlation function of a univariate or a multivariate time series. Both versions of biased and unbiased estimators of distance covariance and correlation are provided. Test statistics for testing pairwise independence are also implemented. Some data sets are also included.

Details

Package: dCovTS
Type: Package
Version: 1.4
Date: 2023-09-28
License: GPL(>=2)

Note

Disclaimer: Dr Maria Pitsillou is the actual creator of this package. Dr Tsagris is the current maintainer.

Improvements: We have modified the codes to run faster, we included the packages Rfast and Rfast2 for fast computations and the "dcov" package that allows for extremely fast computations of the distance correlation/covariance with univariate data.

Author(s)

Michail Tsagris, Maria Pitsillou and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Fokianos, K. and M. Pitsillou. (2018). Testing independence for multivariate time series via the auto-distance correlation matrix. Biometrika, 105, 337-352.

Fokianos, K. and M. Pitsillou. (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159, 262-3270.

Dehling, H. and T. Mikosch. (1994). Random quadratic forms and the bootstrap for U-statistics. Journal of Multivariate Analysis 51, 392-413.

Hong, Y. (1999). Hypothesis testing in time series via the empirical characteristic function: A generalized spectral density approach. Journal of the American Statistical Association, 94, 1201-1220.

Hong, Y. (1996). Consistent testing for serial correlation of unknown form. Econometrica, 64, 837-864.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Leucht, A. and M. H. Neumann (2013). Dependent wild bootstrap for degenerate U- and V- statistics. Journal of Multivariate Analysis, 117, 257-280.

Pitsillou, M. and K. Fokianos. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Politis, N. P., J. P. Romano and M. Wolf (1999). Subsampling. New York: Springer.

Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105, 218-235.

Shumway, R. H. and D. S. Stoffer (2011). Time Series Analysis and Its Applications With R Examples. New York: Springer. Third Edition.

Szekely, G. J. and M. L. Rizzo (2014). Partial distance correlation with methods for dissimilarities. The Annals of Statistics, 42, 2382-2412.

Szekely, G. J., M. L. Rizzo and N. K. Bakirov (2007). Measuring and testing dependence by correlation of distances. The Annals of Statistics, 35, 2769-2794, .

Tsay, R. S. (2014). Multivariate Time Series Analysis with R and Financial Applications. Hoboken, NJ: Wiley.

Tsay, R. S. (2010). Analysis of Financial Time Series. Hoboken, NJ: Wiley. Third edition.

Zhou, Z. (2012). Measuring nonlinear dependence in time series, a distance correlation approach. Journal of Time Series Analysis, 33, 438-457.


Auto-Distance Correlation Function

Description

Computes the auto-distance correlation function of a univariate time series. It also computes the bias-corrected estimator of (squared) auto-distance correlation.

Usage

ADCF(x, MaxLag = 15, unbiased = FALSE)

Arguments

x

A numeric vector or univariate time series.

MaxLag

Maximum lag order at which to calculate the ADCF. Default is 15.

unbiased

Logical value. If unbiased = TRUE, the bias-corrected estimator of squared auto-distance correlation is returned. Default value is FALSE.

Details

Distance covariance and correlation firstly introduced by Szekely et al. (2007) are new measures of dependence between two random vectors. Zhou (2012) extended this measure to univariate time series framework.

For a univariate time series, ADCF computes the auto-distance correlation function, RX(j)R_X(j), between {Xt}\{X_t\} and {Xt+j}\{X_{t+j}\}, whereas ADCV computes the auto-distance covariance function between them, denoted by VX(j)V_X(j). Formal definition of RX()R_X(\cdot) and VX()V_X(\cdot) can be found in Zhou (2012) and Fokianos and Pitsillou (2017). The empirical auto-distance correlation function, R^X(j)\hat{R}_X(j), is computed as the positive square root of

R^X2(j)=V^X2(j)V^X2(0),j=0,±1,±2,\hat{R}_X^2(j)=\frac{\hat{V}_X^2(j)}{\hat{V}_X^2(0)}, \quad j=0, \pm 1, \pm 2, \dots

for V^X2(0)0\hat{V}_X^2(0) \neq 0 and zero otherwise, where V^X()\hat{V}_X(\cdot) is a function of the double centered Euclidean distance matrices of the sample XtX_t and its lagged sample Xt+jX_{t+j} (see ADCV for more details). Theoretical properties of this measure can be found in Fokianos and Pitsillou (2017).

If unbiased = TRUE, ADCF computes the bias-corrected estimator of the squared auto-distance correlation, R~X2(j)\tilde{R}_X^2(j), based on the unbiased estimator of auto-distance covariance function, V~X2(j)\tilde{V}_X^2(j). The definition of V~X2(j)\tilde{V}_X^2(j) relies on the U-centered matrices proposed by Szekely and Rizzo (2014) (see ADCV for a brief description).

mADCF computes the auto-distance correlation function of a multivariate time series.

Value

Returns a vector, whose length is determined by MaxLag, and contains the biased estimator of ADCF or the bias-corrected estimator of squared ADCF.

Note

Based on the definition of ADCF, one can observe that RX2(j)=RX2(j)R^2_X(j)=R^2_X(-j) \forall jj, and so results based on negative lags are omitted.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Fokianos K. and M. Pitsillou (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159(2), 262-3270.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Szekely, G. J. and M. L. Rizzo (2014). Partial distance correlation with methods for dissimilarities. The Annals of Statistics, 42, 2382-2412.

Szekely, G. J. and M. L. Rizzo and N. K. Bakirov (2007). Measuring and testing dependence by correlation of distances. The Annals of Statistics, 35, 2769-2794.

Zhou, Z. (2012). Measuring nonlinear dependence in time series, a distance correlation approach. Journal of Time Series Analysis 33, 438-457.

See Also

ADCFplot, ADCV, mADCF

Examples

x <- rnorm(100)
ADCF(x)

ADCF(ldeaths, 18)

ADCF(mdeaths, unbiased = TRUE)

Auto-distance correlation plot

Description

The function plots the estimated auto-distance correlation function obtained by ADCF and provides confindence intervals by employing three bootstrap based methods.

Usage

ADCFplot(x, MaxLag = 15, alpha = 0.05, b = 499, bootMethod =
c("Wild Bootstrap", "Subsampling", "Independent Bootstrap"), ylim = NULL, main = NULL)

Arguments

x

A numeric vector or univariate time series.

MaxLag

The maximum lag order at which to plot ADCF. Default is 15.

alpha

The significance level used to construct the (1α)(1-\alpha)% empirical critical values.

b

The number of bootstrap replications for constructing the (1α)(1-\alpha)% empirical critical values. Default is 499.

bootMethod

A character string indicating the method to use for obtaining the (1α)(1-\alpha)% critical values. Possible choices are "Wild Bootstrap" (the default), "Independent Bootstrap" and "Subsampling".

ylim

A numeric vector of length 2 indicating the y limits of the plot. The default value, NULL, indicates that the range (0,v)(0,v), where vv is the maximum number between 1 and the empirical critical values, should be used.

main

The title of the plot.

Details

Fokianos and Pitsillou (2018) showed that the sample auto-distance covariance function ADCV (and thus ADCF) can be expressed as a V-statistic of order two, which under the null hypothesis of independence is degenerate. Thus, constructing a plot analogous to the traditional autocorrelation plot where the confidence intervals are obtained simultaneously, turns to be a complicated task. To overcome this issue, the (1α)(1-\alpha)% confidence intervals shown in the plot (dotted blue horizontal line) are computed simultaneously via Monte Carlo simulation, and in particular via the independent wild bootstrap approach (Dehling and Mikosch, 1994; Shao, 2010; Leucht and Neumann, 2013). The reader is referred to Fokianos and Pitsillou (2018) for the steps followed. mADCFplot returns an analogous plot of the estimated auto-distance correlation function for a multivariate time series.

One can also compute the pairwise (1α)(1-\alpha)% critical values via the subsampling approach suggested by Zhou (2012, Section 5.1).That is, the critical values are obtained at each lag separately. The block size of the procedure is based on the minimum volatility method proposed by Politis et al. (1999, Section 9.4.2). In addition, the function provides the ordinary independent bootstrap methodology to derive simultaneous (1α)(1-\alpha)% critical values.

Value

A plot of the estimated ADCF values. It also returns a list including:

ADCF

The sample auto-distance correlation function for all lags specified by MaxLag.

bootMethod

The method followed for computing the (1α)(1-\alpha)% confidence intervals of the plot.

critical.value

The critical value shown in the plot.

Note

When the critical values are obtained via the Subsampling methodology, the function returns a plot that starts from lag 1.

The function plots only the biased estimator of ADCF.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Dehling, H. and T. Mikosch (1994). Random quadratic forms and the bootstrap for U-statistics. Journal of Multivariate Analysis, 51, 392-413.

Dominic, E, K. Fokianos and M. Pitsillou Maria (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Fokianos K. and Pitsillou M. (2018). Testing independence for multivariate time series via the auto-distance correlation matrix. Biometrika, 105, 337-352.

Leucht, A. and M. H. Neumann (2013). Dependent wild bootstrap for degenerate U- and V- statistics. Journal of Multivariate Analysis, 117, 257-280.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Politis, N. P., J. P. Romano and M. Wolf (1999). Subsampling. New York: Springer.

Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105, 218-235.

Zhou, Z. (2012). Measuring nonlinear dependence in time series, a distance correlation approach. Journal of Time Series Analysis, 33, 438-457.

See Also

ADCF, ADCV, mADCFplot

Examples

### x <- rnorm(200)
### ADCFplot(x, bootMethod = "Subs")

Auto-distance Covariance Function

Description

Computes the auto-distance covariance function of a univariate time series. It also computes the unbiased estimator of squared auto-distance covariance.

Usage

ADCV(x, MaxLag = 15, unbiased = FALSE)

Arguments

x

A numeric vector or univariate time series.

MaxLag

The maximum lag order at which to calculate the ADCV. Default is 15.

unbiased

A logical value. If unbiased = TRUE, the unbiased estimator of squared auto-distance covariance is returned. Default value is FALSE.

Details

Szekely et al. (2007) proposed distance covariance function between two random vectors. Zhou (2012) extended this measure of dependence to a time series framework by calling it auto-distance covariance function.

ADCV computes the sample auto-distance covariance function, VX()V_X(\cdot), between {Xt}\{X_t\} and {Xt+j}\{X_{t+j}\}. Formal definition of VX()V_X(\cdot) can be found in Zhou (2012) and Fokianos and Pitsillou (2017).

The empirical auto-distance covariance function, V^X()\hat{V}_X(\cdot), is the non-negative square root defined by

V^X2(j)=1(nj)2r,l=1+jnArlBrl,0j(n1)\hat{V}_X^2(j) = \frac{1}{(n-j)^2}\sum_{r,l=1+j}^{n}{A_{rl}B_{rl}}, \quad 0 \leq j \leq (n-1)

and V^X2(j)=V^X2(j)\hat{V}_X^2(j) = \hat{V}_X^2(-j), for (n1)j<0-(n-1) \leq j < 0, where A=ArlA=A_{rl} and B=BrlB=B_{rl} are Euclidean distances with elements given by

Arl=arlaˉr.aˉ.l+aˉ..A_{rl} = a_{rl} - \bar{a}_{r.} - \bar{a}_{.l} + \bar{a}_{..}

with arl=XrXla_{rl}=|X_r-X_l|, aˉr.=(l=1+jnarl)/(nj)\bar{a}_{r.}=\Bigl(\sum_{l=1+j}^{n}{a_{rl}}\Bigr)/(n-j), aˉ.l=(r=1+jnarl)/(nj)\bar{a}_{.l}=\Bigl(\sum_{r=1+j}^{n}{a_{rl}}\Bigr)/(n-j) , aˉ..=(r,l=1+jnarl)/(nj)2\bar{a}_{..}=\Bigl(\sum_{r,l=1+j}^{n}{a_{rl}}\Bigr)/(n-j)^2. BrlB_{rl} is given analogously based on brl=YrYlb_{rl}=|Y_r-Y_l|, where Yt=Xt+jY_t=X_{t+j}. XtX_t and Xt+jX_{t+j} are independent if and only if VX2(j)=0V_X^2(j)=0. See Fokianos and Pitsillou (2017) for more information on theoretical properties of VX2()V_X^2(\cdot) including consistency.

If unbiased = TRUE, ADCV returns the unbiased estimator of squared auto-distance covariance function, V~X2(j)\tilde{V}_X^2(j), proposed by Szekely and Rizzo (2014). In the context of time series data, this is given by

V~X2(j)=1(nj)(nj3)rlA~rlB~rl,\tilde{V}_X^2(j) = \frac{1}{(n-j)(n-j-3)}\sum_{r\neq l}{\tilde{A}_{rl}\tilde{B}_{rl}},

for n>3n > 3, where A~rl\tilde{A}_{rl} is the (r,l)(r,l) element of the so-called U-centered matrix A~\tilde{A}, defined by

A~rl=1nj2t=1+jnart1nj2s=1+jnasl+1(nj1)(nj2)t,s=1+jnats,ij,\tilde{A}_{rl} = \frac{1}{n-j-2}\sum_{t=1+j}^{n}{a_{rt}}- \frac{1}{n-j-2}\sum_{s=1+j}^{n}{a_{sl}+\frac{1}{(n-j-1)(n-j-2)}\sum_{t,s=1+j}^{n}{a_{ts}}}, \quad i \neq j,

with zero diagonal.

mADCV gives the auto-distance covariance function of a multivariate time series.

Value

A vector whose length is determined by MaxLag and contains the biased estimator of ADCV or the unbiased estimator of squared ADCV.

Note

Based on the definition of V^X()\hat{V}_X(\cdot), we observe that V^X2(j)=V^X2(j)\hat{V}^2_X(j)=\hat{V}^2_X(-j), and thus results based on negative lags are omitted.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Dominic, E, K. Fokianos and M. Pitsillou Maria (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262. .

Fokianos K. and M. Pitsillou (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159(2), 262-3270.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Szekely, G. J. and M. L. Rizzo (2014). Partial distance correlation with methods for dissimilarities. The Annals of Statistics 42, 2382-2412.

Szekely, G. J., M. L. Rizzo and N. K. Bakirov (2007). Measuring and testing dependence by correlation of distances. The Annals of Statistics 35, 2769-2794.

Zhou, Z. (2012). Measuring nonlinear dependence in time series, a distance correlation approach. Journal of Time Series Analysis 33, 438-457.

See Also

ADCF, mADCV

Examples

x <- rnorm(500)
ADCV(x, 18)

ADCV(BJsales, 25)

Monthly returns of IBM and S&P 500 composite index

Description

The monthly returns of the stocks of International Business Machines (IBM) and the S&P 500 composite index from January 1926 to December 2011.

Usage

ibmSp500

Format

A data frame with 1,032 observations on the following 3 variables.

date

a numeric vector

ibm

a numeric vector

sp

a numeric vector

Source

The data is a combination of two datasets:

  • The first 612 observations are in Tsay (2010).

  • The rest 420 observations are in Tsay (2014).

References

Tsay, R. S. (2010). Analysis of Financial Time Series. Hoboken, NJ: Wiley. Third edition.

Tsay, R. S. (2014). Multivariate Time Series Analysis with R and Financial Applications. Hoboken, NJ: Wiley.

Examples

### attach(ibmSp500)
### series <- tail(ibmSp500[, 2:3], 400)
### lseries <- log(series + 1)
### mADCFplot(lseries, MaxLag = 12)
### mADCFplot(lseries^2, MaxLag = 12)

Several kernel functions

Description

Computes several kernel functions(truncated, Bartlett, Daniell, QS, Parzen). These kernels are for constructing test statistics for testing pairwise independence.

Usage

kernelFun(type, z)

Arguments

type

A character string which indicates the name of the smoothing kernel. kernelFun can be: 'truncated', 'bartlett', 'daniell', 'QS', 'parzen'. No default is given.

z

A real number.

Details

kernelFun computes several kernel functions including truncated, Bartlett, Daniell, QS and Parzen.

The exact definition of each of the above functions are given below:

  • Truncated

    k(z)={1,z1,0,otherwise.k(z) = \left\{ \begin{array}{ll} 1, & |z| \leq 1, \\[1ex] 0, & \mbox{otherwise}. \end{array} \right.

  • Bartlett

    k(z)={1z,z1,0,otherwise.k(z) = \left\{ \begin{array}{ll} 1 - |z|, & |z| \leq 1, \\[1ex] 0, & \mbox{otherwise}. \end{array} \right.

  • Daniell

    k(z)=sin(πz)πz,z{0}k(z) = \frac{\mbox{sin}(\pi z)}{\pi z}, z \in \Re - \{0\}

  • QS

    k(z)=(9/5π2z2){sin(5/3πz)/5/3πzcos(5/3πz)},zk(z)=(9/5\pi^2z^2)\{\mbox{sin}(\sqrt{5/3}\pi z)/\sqrt{5/3}\pi z-\mbox{cos}(\sqrt{5/3}\pi z)\}, z \in \Re

  • Parzen

    k(z)={16(πz/6)2+6πz/63,z3/π,2(1πz/6)3,3/πz6/π,0,otherwisek(z) = \left\{ \begin{array}{ll} 1-6(\pi z/6)^2 + 6|\pi z/6|^3, & |z| \leq 3/\pi, \\[1ex] 2(1-|\pi z/6|)^3, & 3/\pi \leq |z| \leq 6/\pi, \\[1ex] 0, & \mbox{otherwise} \end{array} \right.

All these kernel functions are mainly used to smooth the generalized spectral density function, firstly introduced by Hong (1999). Assumptions and theoretical properties of these functions can be found in Hong (1996;1999) and Fokianos and Pitsillou (2017).

Value

A value that lies in the interval [1,1][-1, 1].

Author(s)

Maria Pitsillou and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Fokianos K. and M. Pitsillou (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159, 262-3270.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Hong, Y. (1996). Consistent testing for serial correlation of unknown form. Econometrica, 64, 837-864.

Hong, Y. (1999). Hypothesis testing in time series via the empirical characteristic function: A generalized spectral density approach. Journal of the American Statistical Association, 94, 1201-1220.

Examples

k1 <- kernelFun( "bartlett", z = 1/3 )
k2 <- kernelFun( "bar", z = 1/5 )
k3 <- kernelFun( "dan", z = 0.5 )

Auto-Distance Correlation Matrix

Description

Computes the auto-distance correlation matrix of a multivariate time series.

Usage

mADCF(x, lags, unbiased = FALSE, output = TRUE)

Arguments

x

Multivariate time series.

lags

The lag order at which to calculate the mADCF. No default is given. This can be a single number or a vector of numbers with different lag orders.

unbiased

A logical value. If unbiased = TRUE, the individual elements of auto-distance correlation matrix correspond to the bias-corrected estimators of squared auto-distance correlation functions. Default value is FALSE.

output

A logical value. If output=FALSE, no output is given. Default value is TRUE.

Details

If Xt=(Xt;1,,Xt;d)\textbf{X}_t=(X_{t;1}, \dots, X_{t;d})' is a multivariate time series of dimension dd, then mADCF computes the sample auto-distance correlation matrix, R^()\hat{R}(\cdot), of Xt\textbf{X}_t. It is defined by

R^(j)=[R^rm(j)]r,m=1d,j=0,±1,±2,,\hat{R}(j) = [\hat{R}_{rm}(j)]_{r,m=1}^d, \quad j=0, \pm 1, \pm 2, \dots,

where R^rm(j)\hat{R}_{rm}(j) is the biased estimator of the so-called pairwise auto-distance correlation function between Xt;rX_{t;r} and Xt+j;mX_{t+j;m} given by the positive square root of

R^rm2(j)=V^rm2(j)V^rr(0)V^mm(0)\hat{R}_{rm}^2(j) = \frac{\hat{V}_{rm}^2(j)}{\hat{V}_{rr}(0)\hat{V}_{mm}(0)}

for V^rr(0)V^mm(0)0\hat{V}_{rr}(0)\hat{V}_{mm}(0) \neq 0 and zero otherwise.

V^rm(j)\hat{V}_{rm}(j) is the (r,m)(r,m) element of the corresponding mADCV matrix at lag jj. Formal definition and more details can be found in Fokianos and Pitsillou (2017).

If unbiased = TRUE, mADCF returns a matrix that contains the bias-corrected estimators of squared pairwise auto-distance correlation functions.

Value

If lags is a single number then the function will return a matrix. If lags is a vector of many values the function will return an array. For either case, the matrix (matrices) will contain either the biased estimators of the pairwise auto-distance correlation functions or the bias-corrected estimators of squared pairwise auto-distance correlation functions at lag, jj, determined by the argument lags.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Fokianos K. and Pitsillou M. (2018). Testing independence for multivariate time series via the auto-distance correlation matrix. Biometrika, 105, 337-352.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

See Also

ADCF, mADCV

Examples

x <- matrix( rnorm(200), ncol = 2 )

mADCF(x, 2)

mADCF(x, -2)

mADCF(x, lags = 4, unbiased = TRUE)

Distance cross-correlation plot

Description

The function computes and plots the estimator of the auto-distance correlation matrix mADCF.

Usage

mADCFplot(x, MaxLag = 15, alpha = 0.05, b = 499,
          bootMethod = c("Wild Bootstrap", "Independent Bootstrap"),
          ylim = NULL)

Arguments

x

A multivariate time series.

MaxLag

The maximum lag order at which to plot mADCF. Default is 15.

alpha

The significance level used to construct the (1α)(1-\alpha)% empirical critical values.

b

The number of bootstrap replications for constructing the (1α)(1-\alpha)% empirical critical values. Default is 499.

bootMethod

A character string indicating the method to use for obtaining the (1α)(1-\alpha)% critical values. Possible choices are "Wild Bootstrap" (the default) and "Independent Bootstrap".

ylim

A numeric vector of length 2 indicating the y limits of the plot. The default value, NULL, indicates that the range (0,v)(0,v), where vv is the maximum number between 1 and the empirical critical values, should be used.

Details

The (1α)(1-\alpha)% confidence intervals shown in the plot (dotted blue horizontal line) are computed simultaneously based on the independent wild bootstrap approach (Dehling and Mikosch, 1994; Shao, 2010; Leucht and Neumann, 2013), since the elements of mADCV (and thus mADCF) can be expressed as degenerate V-statistics of order 2. More details can be found in Fokianos and Pitsillou (2017).

In addition, mADCFplot provides the option of independent bootstrap to compute the simultaneous (1α)(1-\alpha)% critical values.

Value

A plot of the estimated mADCF matrices. The function also returns a list including

matrices

Sample distance correlation matrices starting from lag 0.

bootMethod

The method followed for computing the (1α)(1-\alpha)% confidence intervals of the plot.

critical.value

The critical value shown in the plot.

Note

The function plots only the biased estimator of ADCF matrix.

Author(s)

Maria Pitsillou and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Dehling, H. and T. Mikosch (1994). Random quadratic forms and the bootstrap for U-statistics. Journal of Multivariate Analysis, 51, 392-413.

Fokianos K. and Pitsillou M. (2018). Testing independence for multivariate time series via the auto-distance correlation matrix. Biometrika, 105, 337-352.

Fokianos K. and M. Pitsillou (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159, 262-3270.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Leucht, A. and M. H. Neumann (2013). Dependent wild bootstrap for degenerate U- and V- statistics. Journal of Multivariate Analysis, 117, 257-280.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105, 218-235.

See Also

mADCF, mADCV

Examples

### x <- matrix( rnorm(200), ncol = 2 )
### mADCFplot(x, 12, ylim = c(0, 0.5) )
### mADCFplot(x, 12, b = 100)

Distance Correlation test of independence in multivariate time series

Description

A multivariate test of independence based on auto-distance correlation matrix proposed by Fokianos and Pitsillou (2017).

Usage

mADCFtest(x, type = c("truncated", "bartlett", "daniell", "QS", "parzen"), p,
          b = 0, parallel = FALSE, bootMethod = c("Wild Bootstrap",
          "Independent Bootstrap"))

Arguments

x

multivariate time series.

type

A character string which indicates the smoothing kernel. Possible choices are 'truncated' (the default), 'bartlett', 'daniell', 'QS', 'parzen'.

p

The bandwidth, whose choice is determined by p=cnλp=cn^{\lambda} for c>0c > 0 and λ(0,1)\lambda \in (0,1).

b

The number of bootstrap replicates of the test statistic. It is a positive integer. If b=0 (the default), then no p-value is returned.

parallel

A logical value. By default, parallel=FALSE. If parallel=TRUE, bootstrap computation is distributed to multiple cores, which typically is the maximum number of available CPUs and is detecting directly from the function.

bootMethod

A character string indicating the method to use for obtaining the empirical p-value of the test. Possible choices are "Wild Bootstrap" (the default) and "Independent Bootstrap".

Details

mADCFtest performs a test of multivariate independence. In particular, the function computes a test statistic for testing whether the data are independent and identically distributed (i.i.d). The p-value of the test is obtained via resampling method. Possible choices are the independent wild bootstrap (Dehling and Mikosch, 1994; Shao, 2010; Leucht and Neumann, 2013) and the independent bootstrap, with b replicates. The observed statistic is given by

j=1n1(nj)k2(j/p)tr{V^(j)D^1V^(j)D^1}\sum_{j=1}^{n-1}(n-j)k^2(j/p)\mbox{tr}\{\hat{V}^{*}(j)\hat{D}^{-1}\hat{V}(j)\hat{D}^{-1}\}

where D^1=diag{V^11(0),,V^dd(0)}\hat{D}^{-1}=\mbox{diag}\{\hat{V}_{11}(0), \dots, \hat{V}_{dd}(0)\} with dd denoting the dimension of the multivariate time series and V^rm(0)\hat{V}_{rm}(0) is obtained from the elements of the corresponding matrix mADCV. V^()\hat{V}^{*}(\cdot) denotes the complex conjugate matrix of V^()\hat{V}(\cdot) obtained from mADCV, and tr{A}\mbox{tr}\{A\} denotes the trace of a matrix AA. k()k(\cdot) is a kernel function computed by kernelFun and p is a bandwidth or lag order whose choice is further discussed in Fokianos and Pitsillou (2017).

Under the null hypothesis of independence and some further assumptions about the kernel function k()k(\cdot), the standardized version of the test statistic follows N(0,1)N(0,1) asymptotically and it is consistent. More details of the asymptotic properties of the statistic can be found in Fokianos and Pitsillou (2017).

mADCVtest performs the same test based on the auto-distance covariance matrix mADCV.

Value

An object of class htest which is a list containing:

method

The description of the test.

statistic

The observed value of the test statistic.

replicates

The bootstrap replicates of the test statistic (if b=0b=0 then replicates=NULL).

p.value

The p-value of the test (if b=0b=0 then p.value=NA).

bootMethod

The method followed for computing the p-value of the test.

data.name

A description of the data (data name, kernel type, type, bandwidth, p, and the number of bootstrap replicates, b).

Note

The computation of the test statistic is only based on the biased estimator of auto-distance covariance matrix.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Dehling, H. and T. Mikosch (1994). Random quadratic forms and the bootstrap for U-statistics. Journal of Multivariate Analysis, 51, 392-413.

Fokianos K. and Pitsillou M. (2018). Testing independence for multivariate time series via the auto-distance correlation matrix. Biometrika, 105, 337-352.

Fokianos K. and M. Pitsillou (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159, 262-3270.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Leucht, A. and M. H. Neumann (2013). Dependent wild bootstrap for degenerate U- and V- statistics. Journal of Multivariate Analysis, 117, 257-280.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105, 218-235.

See Also

mADCF, mADCV, mADCVtest

Examples

x <- matrix( rnorm(200), ncol = 2 )
n <- length(x)
c <- 3
lambda <- 0.1
p <- ceiling(c * n^lambda)
mF <- mADCFtest(x, type = "truncated", p = p, b = 500, parallel = FALSE)

Auto-Distance Covariance Matrix

Description

Computes the sample auto-distance covariance matrices of a multivariate time series.

Usage

mADCV(x, lags, unbiased = FALSE, output = TRUE)

Arguments

x

Multivariate time series.

lags

The lag order at which to calculate the mADCV. No default is given.

unbiased

A logical value. If unbiased = TRUE, the individual elements of auto-distance covariance matrix correspond to the unbiased estimators of squared auto-distance covariance functions. Default value is FALSE.

output

A logical value. If output=FALSE, no output is given. Default value is TRUE.

Details

Suppose that Xt=(Xt;1,,Xt;d)\textbf{X}_t=(X_{t;1}, \dots, X_{t;d})' is a multivariate time series of dimension dd. Then, mADCV computes the d×dd \times d sample auto-distance covariance matrix, V^()\hat{V}(\cdot), of Xt\textbf{X}_t given by

V^(j)=[V^rm(j)]r,m=1d,j=0,±1,±2,,\hat{V}(j) = [\hat{V}_{rm}(j)]_{r,m=1}^d , \quad j=0, \pm 1, \pm 2, \dots,

where V^rm(j)\hat{V}_{rm}(j) denotes the biased estimator of the pairwise auto-distance covariance function between Xt;rX_{t;r} and Xt+j;mX_{t+j;m}. The definition of V^rm(j)\hat{V}_{rm}(j) is given analogously as in the univariate case (see ADCV). Formal definitions and theoretical properties of auto-distance covariance matrix can be found in Fokianos and Pitsillou (2018).

If unbiased = TRUE, mADCV computes the matrix, V~(2)(j)\tilde{V}^{(2)}(j), whose elements correspond to the unbiased estimators of squared pairwise auto-distance covariance functions, namely

V~(2)(j)=[V~rm2(j)]r,m=1d,j=0,±1,±2,.\tilde{V}^{(2)}(j) = [\tilde{V}^2_{rm}(j)]_{r,m=1}^d , \quad j=0, \pm 1, \pm 2, \dots.

The definition of V~rm2()\tilde{V}_{rm}^2(\cdot) is defined analogously as explained in the univariate case (see ADCV).

Value

If lags is a single number then the function will return a matrix. If lags is a vector of many values the function will return an array. For either case, the matrix (matrices) will contain either the biased estimators of the pairwise auto-distance covariance functions or the unbiased estimators of squared pairwise auto-distance covariance functions at lag, jj, determined by the argument lags.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Fokianos K. and Pitsillou M. (2018). Testing independence for multivariate time series via the auto-distance correlation matrix. Biometrika, 105, 337-352.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

See Also

ADCV, mADCF

Examples

x <- matrix( rnorm(200), ncol = 2 )
mADCV(x, lags = 1)
mADCV(x, lags = 15)

y <- as.ts(swiss)
mADCV(y, 15)
mADCV(y, 15, unbiased = TRUE)

Distance covariance test of independence in multivariate time series

Description

A test of independence based on auto-distance covariance matrix in multivariate time series proposed by Fokianos a nd Pitsillou (2017).

Usage

mADCVtest(x, type = c("truncated", "bartlett", "daniell", "QS", "parzen"), p,
          b = 0, parallel = FALSE, bootMethod = c("Wild Bootstrap",
          "Independent Bootstrap"))

Arguments

x

Multivariate time series.

type

A character string which indicates the smoothing kernel. Possible choices are 'truncated' (the default), 'bartlett', 'daniell', 'QS', 'parzen'.

p

The bandwidth, whose choice is determined by p=cnλp=cn^{\lambda} for c>0c > 0 and λ(0,1)\lambda \in (0,1).

b

The number of bootstrap replicates of the test statistic. It is a positive integer. If b=0 (the default), then no p-value is returned.

parallel

A logical value. By default, parallel=FALSE. If parallel=TRUE, bootstrap computation is distributed to multiple cores, which typically is the maximum number of available CPUs and is detecting directly from the function.

bootMethod

A character string indicating the method to use for obtaining the empirical p-value of the test. Possible choices are "Wild Bootstrap" (the default) and "Independent Bootstrap".

Details

mADCVtest tests whether the vector series are independent and identically distributed (i.i.d). The p-value of the test is obtained via resampling scheme. Possible choices are the independent wild bootstrap (Dehling and Mikosch, 1994; Shao, 2010; Leucht and Neumann, 2013) and independent bootstrap, with b replicates. The observed statistic is

j=1n1(nj)k2(j/p)tr{V^(j)V^(j)}\sum_{j=1}^{n-1}(n-j)k^2(j/p)\mbox{tr}\{\hat{V}^{*}(j)\hat{V}(j)\}

where V^()\hat{V}^{*}(\cdot) denotes the complex conjugate matrix of V^()\hat{V}(\cdot) obtained from mADCV, and tr{A}\mbox{tr}\{A\} denotes the trace of a matrix AA, which is the sum of the diagonal elements of AA. k()k(\cdot) is a kernel function computed by kernelFun and p is a bandwidth or lag order whose choice is further discussed in Fokianos and Pitsillou (2017).

Under the null hypothesis of independence and some further assumptions about the kernel function k()k(\cdot), the standardized version of the test statistic follows N(0,1)N(0,1) asymptotically and it is consistent. More details of the asymptotic properties of the statistic can be found in Fokianos and Pitsillou (2017).

mADCFtest performs the same test based on the distance correlation matrix mADCF.

Value

An object of class htest which is a list including:

method

The description of the test.

statistic

The observed value of the test statistic.

replicates

Bootstrap replicates of the test statistic (if b=0b=0 then replicates=NULL).

p.value

The p-value of the test (if b=0b=0 then p.value=NA).

bootMethod

The method followed for computing the p-value of the test.

data.name

The description of the data (data name, kernel type, type, bandwidth, p, and the number of bootstrap replicates b).

Note

The computation of the test statistic is only based on the biased estimator of auto-distance covariance matrix.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Edelmann, D, K. Fokianos. and M. Pitsillou. (2019). An Updated Literature Review of Distance Correlation and Its Applications to Time Series. International Statistical Review, 87, 237-262.

Dehling, H. and T. Mikosch (1994). Random quadratic forms and the bootstrap for U-statistics. Journal of Multivariate Analysis, 51, 392-413.

Fokianos K. and Pitsillou M. (2018). Testing independence for multivariate time series via the auto-distance correlation matrix. Biometrika, 105, 337-352.

Fokianos K. and M. Pitsillou (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159, 262-3270.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Leucht, A. and M. H. Neumann (2013). Dependent wild bootstrap for degenerate U- and V- statistics. Journal of Multivariate Analysis, 117, 257-280.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105, 218-235.

See Also

mADCV, mADCF, mADCFtest

Examples

x <- matrix( rnorm(200), ncol = 2 )
n <- length(x)
c <- 3
lambda <- 0.1
p <- ceiling(c * n^lambda)
mF <- mADCVtest(x, type = "bar", p = p, b = 500, parallel = FALSE)

Cardiovascular mortality, temperature and pollution data in Los Angeles County

Description

Cardiovascular mortality data measured daily in Los Angeles County over the 10 year period 1970-1979. Temperature series and pollutant particulate series corresponding to mortality data are also given.

Usage

MortTempPart

Format

A data frame with 508 observations on the following 3 variables.

cmort

A numeric vector.

tempr

A numeric vector.

part

A numeric vector.

References

Shumway R. H. and D. S. Stoffer (2011). Time Series Analysis and Its Applications With R Examples. New York: Springer. Third Edition.

Examples

### mADCFplot(MortTempPart[1:100, ], MaxLag = 10)

Testing for independence in univariate time series

Description

A test of pairwise independence for univariate time series.

Usage

UnivTest(x, type = c("truncated", "bartlett", "daniell", "QS", "parzen"),
         testType = c("covariance", "correlation"), p, b = 0, parallel = FALSE,
         bootMethod = c("Wild Bootstrap", "Independent Bootstrap"))

Arguments

x

A numeric vector or univariate time series.

type

A character string which indicates the smoothing kernel. Possible choices are 'truncated' (the default), 'bartlett', 'daniell', 'QS', 'parzen'.

testType

A character string indicating the type of the test to be used. Allowed values are 'covariance' (default) for using the distance covariance function and 'correlation' for using the distance correlation function.

p

The bandwidth, whose choice is determined by p=cnλp=cn^{\lambda} for c>0c > 0 and λ(0,1)\lambda \in (0,1).

b

The number of bootstrap replicates of the test statistic. It is a positive integer. If b=0 (the default), then no p-value is returned.

parallel

A logical value. By default, parallel=FALSE. If parallel=TRUE, bootstrap computation is distributed to multiple cores, which typically is the maximum number of available CPUs and is detecting directly from the function.

bootMethod

A character string indicating the method to use for obtaining the empirical p-value of the test. Possible choices are "Wild Bootstrap" (the default) and "Independent Bootstrap".

Details

UnivTest performs a test on the null hypothesis of independence in univariate time series. The p-value of the test is obtained via resampling method. Possible choices are the independent wild bootstrap (Dehling and Mikosch, 1994; Shao, 2010; Leucht and Neumann, 2013) (default option) and the ordinary independent bootstrap, with b replicates. If typeTest = 'covariance' then, the observed statistic is

j=1n1(nj)k2(j/p)V^X2(j),\sum_{j=1}^{n-1}{(n-j)k^2(j/p)\hat{V}^2_X(j)},

otherwise

j=1n1(nj)k2(j/p)R^X2(j),\sum_{j=1}^{n-1}{(n-j)k^2(j/p)\hat{R}^2_X(j)},

where k()k(\cdot) is a kernel function computed by kernelFun and p is a bandwidth or lag order whose choice is further discussed in Fokianos and Pitsillou (2017).

Under the null hypothesis of independence and some further assumptions about the kernel function k()k(\cdot), the standardizedversion of the test statistic follows N(0,1)N(0,1) asymptotically and it is consistent. More details of the asymptotic properties of the statistic can be found in Fokianos and Pitsillou (2017).

Value

An object of class htest which is a list including:

method

The description of the test.

statistic

The observed value of the test statistic.

replicates

Bootstrap replicates of the test statistic (if b=0b=0 then replicates=NULL).

p.value

The p-value of the test (if b=0b=0 then p.value=NA).

bootMethod

The method followed for computing the p-value of the test.

data.name

Description of data (the data name, kernel type, type, bandwidth, p, and the number of bootstrap replicates b).

Note

The observed statistics of the tests are only based on the biased estimators of distance covariance and correlation functions.

Author(s)

Maria Pitsillou, Michail Tsagris and Konstantinos Fokianos.

References

Dehling, H. and T. Mikosch (1994). Random quadratic forms and the bootstrap for U-statistics. Journal of Multivariate Analysis, 51, 392-413.

Fokianos K. and M. Pitsillou (2017). Consistent testing for pairwise dependence in time series. Technometrics, 159(2), 262-3270.

Huo, X. and G. J. Szekely. (2016). Fast Computing for Distance Covariance. Technometrics, 58, 435-447.

Leucht, A. and M. H. Neumann (2013). Dependent wild bootstrap for degenerate U- and V- statistics. Journal of Multivariate Analysis, 117, 257-280.

Pitsillou M. and Fokianos K. (2016). dCovTS: Distance Covariance/Correlation for Time Series. R Journal, 8, 324-340.

Shao, X. (2010). The dependent wild bootstrap. Journal of the American Statistical Association, 105, 218-235.

See Also

ADCF, ADCV

Examples

dat <- tail(ibmSp500[, 2], 100)
n2 <- length(dat)
c2 <- 3
lambda2 <- 0.1
p2 <- ceiling(c2 * n2^lambda2)
testCov <- UnivTest(dat, type = "par", testType = "covariance", p = p2,
                    b = 500, parallel = FALSE)
testCor <- UnivTest(dat, type = "par", testType = "correlation", p = p2,
                    b = 500, parallel = FALSE)