Type: | Package |
Title: | Distance Covariance and Correlation for Time Series Analysis |
Version: | 1.4 |
Date: | 2023-09-28 |
Author: | Michail Tsagris [aut, cre], Maria Pitsillou [aut, cph], Konstantinos Fokianos [aut] |
Maintainer: | Michail Tsagris <mtsagris@uoc.gr> |
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>. |
Depends: | R (≥ 4.0) |
Imports: | dcov, doParallel, foreach, parallel, Rfast, Rfast2 |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
LazyData: | true |
NeedsCompilation: | no |
Packaged: | 2023-09-28 18:19:24 UTC; mtsag |
Repository: | CRAN |
Date/Publication: | 2023-09-28 19:10:02 UTC |
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 |
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, R_X(j)
,
between \{X_t\}
and \{X_{t+j}\}
, whereas ADCV
computes the auto-distance covariance function
between them, denoted by V_X(j)
. Formal definition of R_X(\cdot)
and V_X(\cdot)
can be found in Zhou (2012)
and Fokianos and Pitsillou (2017). The empirical auto-distance correlation function, \hat{R}_X(j)
, is computed as the
positive square root of
\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 \hat{V}_X^2(0) \neq 0
and zero otherwise, where \hat{V}_X(\cdot)
is a function of the double
centered Euclidean distance matrices of the sample X_t
and its lagged sample X_{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,
\tilde{R}_X^2(j)
, based on the unbiased estimator of auto-distance covariance function, \tilde{V}_X^2(j)
.
The definition of \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 R^2_X(j)=R^2_X(-j)
\forall
j
,
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
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 |
alpha |
The significance level used to construct the |
b |
The number of bootstrap replications for constructing the |
bootMethod |
A character string indicating the method to use for obtaining the |
ylim |
A numeric vector of length 2 indicating the |
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-\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-\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-\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 |
bootMethod |
The method followed for computing the |
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
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 |
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,
V_X(\cdot)
, between \{X_t\}
and \{X_{t+j}\}
. Formal
definition of V_X(\cdot)
can be found in Zhou (2012) and Fokianos and
Pitsillou (2017).
The empirical auto-distance covariance function, \hat{V}_X(\cdot)
,
is the non-negative square root defined by
\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 \hat{V}_X^2(j) = \hat{V}_X^2(-j)
, for -(n-1) \leq j < 0
,
where A=A_{rl}
and B=B_{rl}
are Euclidean distances with elements
given by
A_{rl} = a_{rl} - \bar{a}_{r.} - \bar{a}_{.l} + \bar{a}_{..}
with a_{rl}=|X_r-X_l|
, \bar{a}_{r.}=\Bigl(\sum_{l=1+j}^{n}{a_{rl}}\Bigr)/(n-j)
,
\bar{a}_{.l}=\Bigl(\sum_{r=1+j}^{n}{a_{rl}}\Bigr)/(n-j)
, \bar{a}_{..}=\Bigl(\sum_{r,l=1+j}^{n}{a_{rl}}\Bigr)/(n-j)^2
.
B_{rl}
is given analogously based on b_{rl}=|Y_r-Y_l|
, where
Y_t=X_{t+j}
. X_t
and
X_{t+j}
are independent if and only if V_X^2(j)=0
.
See Fokianos and Pitsillou (2017) for more information on theoretical
properties of V_X^2(\cdot)
including consistency.
If unbiased = TRUE, ADCV
returns the unbiased estimator of
squared auto-distance covariance function,
\tilde{V}_X^2(j)
, proposed by Szekely and Rizzo (2014).
In the context of time series data, this is given by
\tilde{V}_X^2(j) = \frac{1}{(n-j)(n-j-3)}\sum_{r\neq l}{\tilde{A}_{rl}\tilde{B}_{rl}},
for n > 3
, where \tilde{A}_{rl}
is the (r,l)
element of the so-called U-centered matrix
\tilde{A}
, defined by
\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 \hat{V}_X(\cdot)
, we observe that
\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
Examples
x <- rnorm(500)
ADCV(x, 18)
ADCV(BJsales, 25)
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 |
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
\sum_{j=1}^{n-1}{(n-j)k^2(j/p)\hat{V}^2_X(j)},
otherwise
\sum_{j=1}^{n-1}{(n-j)k^2(j/p)\hat{R}^2_X(j)},
where 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(\cdot)
, the standardizedversion of the test
statistic follows 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 |
p.value |
The p-value of the test (if |
bootMethod |
The method followed for computing the p-value of the test. |
data.name |
Description of data (the data name, kernel type, |
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
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)
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.
|
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) = \left\{ \begin{array}{ll} 1, & |z| \leq 1, \\[1ex] 0, & \mbox{otherwise}. \end{array} \right.
Bartlett
k(z) = \left\{ \begin{array}{ll} 1 - |z|, & |z| \leq 1, \\[1ex] 0, & \mbox{otherwise}. \end{array} \right.
Daniell
k(z) = \frac{\mbox{sin}(\pi z)}{\pi z}, z \in \Re - \{0\}
QS
k(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) = \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]
.
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 |
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 \textbf{X}_t=(X_{t;1}, \dots, X_{t;d})'
is a multivariate time series
of dimension d
, then mADCF
computes the sample auto-distance
correlation matrix, \hat{R}(\cdot)
, of \textbf{X}_t
. It is defined by
\hat{R}(j) = [\hat{R}_{rm}(j)]_{r,m=1}^d, \quad j=0, \pm 1, \pm 2, \dots,
where \hat{R}_{rm}(j)
is the biased estimator of the so-called pairwise
auto-distance correlation function between
X_{t;r}
and X_{t+j;m}
given by the positive square root of
\hat{R}_{rm}^2(j) = \frac{\hat{V}_{rm}^2(j)}{\hat{V}_{rr}(0)\hat{V}_{mm}(0)}
for \hat{V}_{rr}(0)\hat{V}_{mm}(0) \neq 0
and zero otherwise.
\hat{V}_{rm}(j)
is the (r,m)
element of the corresponding
mADCV
matrix at lag j
.
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, j
, 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
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 |
alpha |
The significance level used to construct the |
b |
The number of bootstrap replications for constructing the |
bootMethod |
A character string indicating the method to use for obtaining the
|
ylim |
A numeric vector of length 2 indicating the |
Details
The (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-\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 |
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
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 |
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
\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 \hat{D}^{-1}=\mbox{diag}\{\hat{V}_{11}(0), \dots, \hat{V}_{dd}(0)\}
with d
denoting the dimension of the
multivariate time series and \hat{V}_{rm}(0)
is obtained from the elements of the corresponding matrix mADCV
.
\hat{V}^{*}(\cdot)
denotes the complex conjugate matrix of \hat{V}(\cdot)
obtained from mADCV
, and
\mbox{tr}\{A\}
denotes the trace of a matrix A
. 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(\cdot)
, the standardized
version of the test statistic follows 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 |
p.value |
The p-value of the test (if |
bootMethod |
The method followed for computing the p-value of the test. |
data.name |
A description of the data (data name, kernel type, |
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
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 |
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 \textbf{X}_t=(X_{t;1}, \dots, X_{t;d})'
is a multivariate
time series of dimension d
.
Then, mADCV
computes the d \times d
sample auto-distance
covariance matrix, \hat{V}(\cdot)
,
of \textbf{X}_t
given by
\hat{V}(j) = [\hat{V}_{rm}(j)]_{r,m=1}^d , \quad j=0, \pm 1, \pm 2, \dots,
where \hat{V}_{rm}(j)
denotes the biased estimator of the pairwise
auto-distance covariance function between
X_{t;r}
and X_{t+j;m}
. The definition of \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,
\tilde{V}^{(2)}(j)
, whose elements correspond to the unbiased estimators
of squared pairwise auto-distance covariance functions, namely
\tilde{V}^{(2)}(j) = [\tilde{V}^2_{rm}(j)]_{r,m=1}^d , \quad j=0, \pm 1, \pm 2, \dots.
The definition of \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, j
,
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
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 |
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
\sum_{j=1}^{n-1}(n-j)k^2(j/p)\mbox{tr}\{\hat{V}^{*}(j)\hat{V}(j)\}
where \hat{V}^{*}(\cdot)
denotes the complex conjugate matrix of \hat{V}(\cdot)
obtained from mADCV
, and
\mbox{tr}\{A\}
denotes the trace of a matrix A
, which is the sum of the diagonal elements of A
. 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(\cdot)
, the standardized
version of the test statistic follows 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 |
p.value |
The p-value of the test (if |
bootMethod |
The method followed for computing the p-value of the test. |
data.name |
The description of the data (data name, kernel type, |
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
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)