Learn R Programming

tsBSS (version 1.0.0)

lbtest: Modified Ljung-Box Test and Volatility Clustering Test for Time Series.

Description

Modified Ljung-Box test and volatility clustering test for time series. Time series can be univariate or multivariate. The modified Ljung-Box test checks whether there is linear autocorrelation in the time series. The volatility clustering test checks whether the time series has squared autocorrelation, which would indicate a presence of volatility clustering.

Usage

lbtest(X, k, type = c("squared", "linear"))

# S3 method for lbtest print(x, digits = 3, ...)

Arguments

X

A numeric vector/matrix or a univariate/multivariate time series object of class ts, xts or zoo. Missing values are not allowed.

k

A vector of lags.

type

The type of the autocorrelation test. Options are Modified Ljung-Box test ("linear") or volatility clustering test ("squared") autocorrelation. Default is "squared".

x

An object of class lbtest

digits

The number of digits when printing an object of class lbtest. Default is 3

Further arguments to be passed to or from methods.

Value

A list of class 'lbtest' containing the following components:

TS

The values of the test statistic for each component of X as a vector.

p_val

The p-values based on the test statistic for each component of X as a vector.

Xname

The name of the data used as a character string.

varnames

The names of the variables used as a character string vector.

k

The lags used for testing the serial autocorrelation as a vector.

K

The total number of lags used for testing the serial autocorrelation.

type

The type of the autocorrelation test.

Details

Assume all the individual time series \(X_i\) in \(\bf X\) with \(T\) observations are scaled to have variance 1.

Then the modified Ljung-Box test statistic for testing the existence of linear autocorrelation in \(X_i\) (option = "linear") is $$T \sum_{j \in k} \left(\sum_{t=1}^T (X_{it} X_{i, t + j})/(T - j)\right)^2/V_{j}.$$

Here $$V_{j} = \sum_{t=1}^{n-j}\frac{x_t^2 x_{t+j}^2}{n-j} + 2 \sum_{k=1}^{n-j-1} \frac{n-k}{n} \sum_{s=1}^{n-k-j}\frac{x_s x_{s+j }x_{s+k} x_{s+k+j}}{n-k-j}.$$ where \(t = 1, \ldots, n - j\), \(k = 1, \ldots, n - j - 1\) and \(s = 1, \ldots, n - k - j\).

The volatility clustering test statistic (option = "squared") is $$T \sum_{j \in k} \left(\sum_{t=1}^T (X_{it}^2 X_{i, t + j}^2)/(T - j) - 1\right)^2$$

Test statistic related to each time series \(X_i\) is then compared to \(\chi^2\)-distribution with length(k) degrees of freedom, and the corresponding p-values are produced. Small p-value indicates the existence of autocorrelation.

References

Miettinen, M., Matilainen, M., Nordhausen, K. and Taskinen, S. (2020), Extracting Conditionally Heteroskedastic Components Using Independent Component Analysis, Journal of Time Series Analysis, 41, 293--311.

See Also

FixNA, gFOBI, gJADE, vSOBI, gSOBI

Examples

Run this code
# NOT RUN {
if(require("stochvol")) {
n <- 10000
s1 <- svsim(n, mu = -10, phi = 0.95, sigma = 0.1)$y
s2 <- rnorm(n)
S <- cbind(s1, s2)

lbtest(S, 1:3, type = "squared")
# First p-value should be very close to zero, as there exists stochastic volatility
}
# }

Run the code above in your browser using DataLab