The function cc.test computes the test statistics for examining the null hypothesis of zero cross-correlation for bivariate time series given in Dalla, Giraitis and Phillips (2022).
cc.test(x, y, max.lag, m0 = 0, alpha = 0.05, lambda = 2.576,
plot = TRUE, var.names = NULL, scale.font = 1)An object of class "cc.test", which is a list with the following components:
The lags of the sample cross-correlations.
The sample cross-correlations.
The lower and upper limit of the confidence bands based on the standard test statistics.
The lower and upper limit of the confidence bands based on the robust test statistics.
The \(t\) test statistics.
The p-values for the \(t\) test statistics.
The \(\widetilde{t}\) test statistics.
The p-values for the \(\widetilde{t}\) test statistics.
The lags of the cumulative test statistics.
The \(HB\) test statistics.
The p-values for the \(HB\) test statistics.
The \(\widetilde{Q}\) test statistics.
The p-values for the \(\widetilde{Q}\) test statistics.
Significance level for hypothesis testing used in the plots.
The variable names used in the plots/table.
A numeric vector or a univariate numeric time series (ts, xts, zoo) object or a data frame variable.
A numeric vector or a univariate numeric time series (ts, xts, zoo) object or a data frame variable.
Maximum lag at which to calculate the test statistics.
Minimum lag at which to calculate the cumulative test statistics. Default is 0.
Significance level for hypothesis testing used in the plots. Default is 0.05.
Threshold in \(\widetilde{Q}\) test statistics. Default is 2.576.
Logical. If TRUE, 1) the sample cross-correlations with their confidence bands are plotted and 2) the cumulative test statistics with their critical values are plotted. Default is TRUE. Can be a logical vector for each of the plots 1)-2).
NULL or a character string specifying the variable names. If NULL and x,y have names, the names of x,y are used. If NULL and x,y have no names, the string c("x","y") is used. Default is NULL.
A positive number indicating the scaling of the font size in the plots. Default is 1.
Violetta Dalla, Liudas Giraitis and Peter C. B. Phillips
The standard \(t\) and robust \(\widetilde{t}\) statistics are for testing the null hypothesis \(H_0:\rho_k=0\) at lags \(k=-max.lag,...,-1,0,1,max.lag\), and the standard \(HB\) and robust \(\widetilde{Q}\) statistics are for testing the null hypothesis \(H_0:\rho_{m_0}=...=\rho_m=0\) at lags \(m=-max.lag,...,-1,0,1,max.lag\), where \(\rho_k\) denotes the cross-correlation of \(x_t\) and \(y_{t-k}\) at lag \(k\).
Dalla, V., Giraitis, L. and Phillips, P. C. B. (2022). "Robust Tests for White Noise and Cross-Correlation". Econometric Theory, 38(5), 913-941, tools:::Rd_expr_doi("doi:10.1017/S0266466620000341"). Cowles Foundation, Discussion Paper No. 2194RS, https://elischolar.library.yale.edu/cowles-discussion-paper-series/57/.
Giraitis, L., Li, Y. and Phillips, P. C. B. (2024). "Robust Inference on Correlation under General Heterogeneity". Journal of Econometrics, 244(1), 105691, tools:::Rd_expr_doi("doi:10.1016/j.jeconom.2024.105691").
x <- rnorm(100)
y <- rnorm(100)
cc.test(x, y, max.lag = 10)
Run the code above in your browser using DataLab