cor_stat | R Documentation |
Computes the test statistic for a CUSUM-based tests on changes in Spearman's rho or Kendall's tau.
cor_stat(x, version = c("tau", "rho"), method = "kernel", control = list())
x |
time series (numeric or ts vector). |
version |
version of the test. Either |
method |
methods of long run variance estimation. Options are |
control |
a list of control parameters. |
Let n
be the length of the time series, i.e. the number of rows in x
. In general, the (scaled) CUSUM test statistic is defined as
\hat{T}_{\xi; n} = \max_{k = 1, ..., n} \frac{k}{2\sqrt{n}\hat{\sigma}} | \hat{\xi}_k - \hat{\xi}_n |,
where \hat{\xi}
is an estimator for the property on which to test, and \hat{\sigma}
is an estimator for the square root of the corresponding long run variance (cf. lrv
).
If version = "tau"
, the function tests if the correlation between x_i
and x_i
of the bivariate time series (x_i, x_i)_{i = 1, ..., n}
stays constant for all i = 1, ..., n
by considering Kendall's tau. Therefore, \hat{\xi} = \hat{\tau}
is the the sample version of Kendall's tau:
\hat{\tau}_k = \frac{2}{k(k-1)} \sum_{1 \leq i < j \leq k} sign\left((x_j - x_i)(y_j - y_i)\right).
The default bandwidth for the kernel-based long run variance estimation is b_n = \lfloor 2n^{1/3} \rfloor
and the default kernel function is the quatratic kernel.
If version = "rho"
, the function tests if the correlation of a time series of an arbitrary dimension d
(>= 2) stays constant by considering a multivariate version of Spearman's rho. Therefore, \hat{\xi} = \hat{\rho}
is the sample version of Spearman's rho:
\hat{\rho}_k = a(d) \left( \frac{2^d}{k} \sum_{j = 1}^k \prod_{i = 1}^d (1 - U_{i, j; n}) - 1 \right)
where U_{i, j; n} = n^{-1}
(rank of x_{i,j}
in x_{i,1}, ..., x_{i,n})
and a(d) = (d+1) / (2^d - d - 1)
. Here it is essential to use \hat{U}_{i, j; n}
instead of \hat{U}_{i, j; k}
. The default bandwidth for the kernel-based long run variance estimation is \sqrt{n}
and the default kernel function is the Bartlett kernel.
Test statistic (numeric value) with the following attributes:
cp-location |
indicating at which index a change point is most likely. |
teststat |
test process (before taking the maximum). |
lrv-estimation |
long run variance estimation method. |
sigma |
estimated long run variance. |
param |
parameter used for the lrv estimation. |
kFun |
kernel function used for the lrv estimation. |
Is an S3 object of the class "cpStat".
Sheila Görz
Wied, D., Dehling, H., Van Kampen, M., and Vogel, D. (2014). A fluctuation test for constant Spearman’s rho with nuisance-free limit distribution. Computational Statistics & Data Analysis, 76, 723-736.
lrv
, cor_cusum
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.