| Title: | Testing Zero Correlation |
|---|---|
| Description: | Computes the test statistics for examining the significance of autocorrelation in univariate time series, cross-correlation in bivariate time series, Pearson correlations in multivariate series and test statistics for i.i.d. property of univariate series given in Dalla, Giraitis and Phillips (2022), <https://www.cambridge.org/core/journals/econometric-theory/article/abs/robust-tests-for-white-noise-and-crosscorrelation/4D77C12C52433F4C6735E584C779403A>, <https://elischolar.library.yale.edu/cowles-discussion-paper-series/57/>. |
| Authors: | Violetta Dalla [aut, cre], Liudas Giraitis [aut], Peter C. B. Phillips [aut] |
| Maintainer: | Violetta Dalla <[email protected]> |
| License: | GPL-3 |
| Version: | 0.4.0 |
| Built: | 2026-05-20 09:55:08 UTC |
| Source: | https://github.com/cran/testcorr |
The function ac.test computes the test statistics for examining the null hypothesis of zero autocorrelation for univariate time series given in Dalla, Giraitis and Phillips (2022).
ac.test(x, max.lag, m0 = 1, alpha = 0.05, lambda = 2.576, plot = TRUE, var.name = NULL, scale.font = 1)ac.test(x, max.lag, m0 = 1, alpha = 0.05, lambda = 2.576, plot = TRUE, var.name = NULL, scale.font = 1)
x |
A numeric vector or a univariate numeric time series (ts, xts, zoo) object or a data frame variable. |
max.lag |
Maximum lag at which to calculate the test statistics. |
m0 |
Minimum lag at which to calculate the cumulative test statistics. Default is 1. |
alpha |
Significance level for hypothesis testing used in the plots. Default is 0.05. |
lambda |
Threshold in |
plot |
Logical. If TRUE, 1) the sample autocorrelations 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). |
var.name |
NULL or a character string specifying the variable name. If NULL and x has name, the name of x is used. If NULL and x has no name, the string "x" is used. Default is NULL. |
scale.font |
A positive number indicating the scaling of the font size in the plots. Default is 1. |
The standard and robust statistics are for testing the null hypothesis at lags ,
and the standard and robust statistics are for testing the null hypothesis at lags ,
where denotes the autocorrelation of at lag .
An object of class "ac.test", which is a list with the following components:
lag |
The lags of the sample autocorrelations. |
ac |
The sample autocorrelations. |
scb |
The lower and upper limit of the confidence bands based on the standard test statistics. |
rcb |
The lower and upper limit of the confidence bands based on the robust test statistics. |
t |
The |
pvt |
The p-values for the |
ttilde |
The |
pvttilde |
The p-values for the |
lagc |
The lags of the cumulative test statistics. |
lb |
The |
pvlb |
The p-values for the |
qtilde |
The |
pvqtilde |
The p-values for the |
alpha |
Significance level for hypothesis testing used in the plots. |
varname |
The variable name used in the plots/table. |
Missing values are not allowed.
Violetta Dalla, Liudas Giraitis and Peter C. B. Phillips
Dalla, V., Giraitis, L. and Phillips, P. C. B. (2022). "Robust Tests for White Noise and Cross-Correlation". Econometric Theory, 38(5), 913-941, 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, doi:10.1016/j.jeconom.2024.105691.
x <- rnorm(100) ac.test(x, max.lag = 10)x <- rnorm(100) ac.test(x, max.lag = 10)
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)cc.test(x, y, max.lag, m0 = 0, alpha = 0.05, lambda = 2.576, plot = TRUE, var.names = NULL, scale.font = 1)
x |
A numeric vector or a univariate numeric time series (ts, xts, zoo) object or a data frame variable. |
y |
A numeric vector or a univariate numeric time series (ts, xts, zoo) object or a data frame variable. |
max.lag |
Maximum lag at which to calculate the test statistics. |
m0 |
Minimum lag at which to calculate the cumulative test statistics. Default is 0. |
alpha |
Significance level for hypothesis testing used in the plots. Default is 0.05. |
lambda |
Threshold in |
plot |
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). |
var.names |
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. |
scale.font |
A positive number indicating the scaling of the font size in the plots. Default is 1. |
The standard and robust statistics are for testing the null hypothesis at lags ,
and the standard and robust statistics are for testing the null hypothesis at lags ,
where denotes the cross-correlation of and at lag .
An object of class "cc.test", which is a list with the following components:
lag |
The lags of the sample cross-correlations. |
cc |
The sample cross-correlations. |
scb |
The lower and upper limit of the confidence bands based on the standard test statistics. |
rcb |
The lower and upper limit of the confidence bands based on the robust test statistics. |
t |
The |
pvt |
The p-values for the |
ttilde |
The |
pvtttilde |
The p-values for the |
lagc |
The lags of the cumulative test statistics. |
hb |
The |
pvhb |
The p-values for the |
qtilde |
The |
pvqtilde |
The p-values for the |
alpha |
Significance level for hypothesis testing used in the plots. |
varnames |
The variable names used in the plots/table. |
Missing values are not allowed.
Violetta Dalla, Liudas Giraitis and Peter C. B. Phillips
Dalla, V., Giraitis, L. and Phillips, P. C. B. (2022). "Robust Tests for White Noise and Cross-Correlation". Econometric Theory, 38(5), 913-941, 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, doi:10.1016/j.jeconom.2024.105691.
x <- rnorm(100) y <- rnorm(100) cc.test(x, y, max.lag = 10)x <- rnorm(100) y <- rnorm(100) cc.test(x, y, max.lag = 10)
The function iid.test computes the test statistics for examining the null hypothesis of i.i.d. property for univariate series given in Dalla, Giraitis and Phillips (2022).
iid.test(x, max.lag, m0 = 1, alpha = 0.05, plot = TRUE, var.name = NULL, scale.font = 1)iid.test(x, max.lag, m0 = 1, alpha = 0.05, plot = TRUE, var.name = NULL, scale.font = 1)
x |
A numeric vector or a univariate numeric time series (ts, xts, zoo) object or a data frame variable. |
max.lag |
Maximum lag at which to calculate the test statistics. |
m0 |
Minimum lag at which to calculate the cumulative test statistics. Default is 1. |
alpha |
Significance level for hypothesis testing used in the plots. Default is 0.05. |
plot |
Logical. If TRUE, 1) the test statistics (J) and their critical values are plotted and 2) the cumulative test statistics (C) with their critical values are plotted. Default is TRUE. Can be a logical vector for each of the plots 1)-2). |
var.name |
NULL or a character string specifying the variable name. If NULL and x has name, the name of x is used. If NULL and x has no name, the string "x" is used. Default is NULL. |
scale.font |
A positive number indicating the scaling of the font size in the plots. Default is 1. |
The and statistics are for testing the null hypothesis of i.i.d. at lag , ,
and the and statistics are for testing the null hypothesis of i.i.d. at lags , .
An object of class "iid.test", which is a list with the following components:
lag |
The lags of the test statistics. |
jab |
The |
pvjab |
The p-values for the |
jsq |
The |
pvjsq |
The p-values for the |
lagc |
The lags of the cumulative test statistics. |
cab |
The |
pvcab |
The p-values for the |
csq |
The |
pvcsq |
The p-values for the |
alpha |
Significance level for hypothesis testing used in the plots. |
varname |
The variable name used in the plots/table. |
Missing values are not allowed.
Violetta Dalla, Liudas Giraitis and Peter C. B. Phillips
Dalla, V., Giraitis, L. and Phillips, P. C. B. (2022). "Robust Tests for White Noise and Cross-Correlation". Econometric Theory, 38(5), 913-941, doi:10.1017/S0266466620000341. Cowles Foundation, Discussion Paper No. 2194RS, https://elischolar.library.yale.edu/cowles-discussion-paper-series/57/.
x <- rnorm(100) iid.test(x, max.lag = 10)x <- rnorm(100) iid.test(x, max.lag = 10)
The function rcorr.test computes the test statistics for examining the null hypothesis of zero Pearson correlation for multivariate series in Dalla, Giraitis and Phillips (2022).
rcorr.test(x, plot = TRUE, var.names = NULL, scale.font = 1)rcorr.test(x, plot = TRUE, var.names = NULL, scale.font = 1)
x |
A numeric matrix or a multivariate numeric time series object (ts, xts, zoo) or a data frame. |
plot |
Logical. If TRUE the sample Pearson correlations and the p-values for significance are plotted. Default is TRUE. |
var.names |
NULL or a character string specifying the variable names. If NULL and x has names, the names of x are used. If NULL and x has no names, the string c("x[1]","x[2]",...) is used. Default is NULL. |
scale.font |
A positive number indicating the scaling of the font size in the plots. Default is 1. |
The p-value of the robust statistic is for testing the null hypothesis ,
where denotes the correlation of and .
An object of class "rcorr.test", which is a list with the following components:
pc |
The sample Pearson correlations. |
pv |
The p-values for the |
varnames |
The variable names used in the plot/table. |
Missing values are not allowed.
Violetta Dalla, Liudas Giraitis and Peter C. B. Phillips
Dalla, V., Giraitis, L. and Phillips, P. C. B. (2022). "Robust Tests for White Noise and Cross-Correlation". Econometric Theory, 38(5), 913-941, 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, doi:10.1016/j.jeconom.2024.105691.
x <- matrix(rnorm(400), 100) rcorr.test(x)x <- matrix(rnorm(400), 100) rcorr.test(x)