Learn R Programming

testcorr (version 0.3.0)

ac.test: Testing zero autocorrelation

Description

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).

Usage

ac.test(x, max.lag, m0 = 1, alpha = 0.05, lambda = 2.576,
        plot = TRUE, var.name = NULL, scale.font = 1)

Value

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 \(t\) test statistics.

pvt

The p-values for the \(t\) test statistics.

ttilde

The \(\widetilde{t}\) test statistics.

pvttilde

The p-values for the \(\widetilde{t}\) test statistics.

lagc

The lags of the cumulative test statistics.

lb

The \(LB\) test statistics.

pvlb

The p-values for the \(LB\) test statistics.

qtilde

The \(\widetilde{Q}\) test statistics.

pvqtilde

The p-values for the \(\widetilde{Q}\) test statistics.

alpha

Significance level for hypothesis testing used in the plots.

varname

The variable name used in the plots/table.

Arguments

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 \(\widetilde{Q}\) test statistics. Default is 2.576.

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.

Author

Violetta Dalla, Liudas Giraitis and Peter C. B. Phillips

Details

The standard \(t\) and robust \(\widetilde{t}\) statistics are for testing the null hypothesis \(H_0:\rho_k=0\) at lags \(k=1,...,max.lag\), and the standard \(LB\) and robust \(\widetilde{Q}\) statistics are for testing the null hypothesis \(H_0:\rho_{m_0}=...=\rho_m=0\) at lags \(m=m_0,...,max.lag\), where \(\rho_k\) denotes the autocorrelation of \(x_t\) at lag \(k\).

References

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").

Examples

Run this code
x <- rnorm(100)
ac.test(x, max.lag = 10)

Run the code above in your browser using DataLab