| Title: | Testing True Long Memory Against Spurious Long Memory |
|---|---|
| Description: | Implements a test for distinguishing between true long memory and spurious long memory. Reference: Qu, Z. (2011). "A Test Against Spurious Long Memory." Journal of Business & Economic Statistics, 29(3), 423–438. <doi:10.1198/jbes.2010.09153>. |
| Authors: | Zhongjun Qu [aut, cre], Cheolju Kim [aut] |
| Maintainer: | Zhongjun Qu <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0.0 |
| Built: | 2026-05-31 08:43:45 UTC |
| Source: | https://github.com/cran/SpuriousMemory |
Fits ARFIMA(p, d, q) models with using
fracdiff, selects the specification by AIC,
and applies the corresponding linear filter to the series.
filterx(x, n = NULL)filterx(x, n = NULL)
x |
A numeric vector containing the time series to be filtered. |
n |
An integer giving the length of the filtered series. If |
The function considers ARFIMA(1, d, 1), ARFIMA(1, d, 0), ARFIMA(0, d, 1), and ARFIMA(0, d, 0) models, computes AIC for each, and selects the model with the smallest AIC. If the absolute value of the selected AR or MA coefficient is greater than or equal to 0.99, the procedure selects a pure fractional model ARFIMA(0, d, 0). The input series is centered before estimation.
A numeric vector of length n containing the filtered series.
set.seed(123) sim <- fracdiff::fracdiff.sim( n = 1000, ar = 0.3, # AR(1) coefficient ma = -0.4, # MA(1) coefficient d = 0.25 # fractional differencing parameter ) x <- sim$series y <- filterx(x)set.seed(123) sim <- fracdiff::fracdiff.sim( n = 1000, ar = 0.3, # AR(1) coefficient ma = -0.4, # MA(1) coefficient d = 0.25 # fractional differencing parameter ) x <- sim$series y <- filterx(x)
Tests the null hypothesis of true long memory against the alternative of spurious long memory (e.g., due to level shifts or trends) using the Qu (2011) test.
Longmemorytest( x, demean = TRUE, alpha = 0.05, filter = TRUE, print_results = TRUE )Longmemorytest( x, demean = TRUE, alpha = 0.05, filter = TRUE, print_results = TRUE )
x |
Numeric vector of time series data |
demean |
Logical, demean the series (default: TRUE) |
alpha |
Numeric, significance level: 0.01, 0.025, 0.05, or 0.10 (default: 0.05) |
filter |
Logical, apply a pre-whitening filter to reduce short-memory dynamics that may otherwise affect the size of the test in finite samples (default: TRUE). |
print_results |
Logical, print results (default: TRUE) |
The test uses bandwidth parameter m = n^0.7 with trimming parameters 0.02 or 0.05 as recommended by Qu (2011). Critical values are based on these settings. Whether the pre-whitening filter is applied does not affect the asymptotic critical values.
A list with elements:
d_estimate |
Local Whittle estimate of the long memory parameter. |
test_stat_eps02 |
Test statistic with trimming parameter epsilon = 0.02. |
test_stat_eps05 |
Test statistic with trimming parameter epsilon = 0.05. |
critical_value_eps02 |
Critical value for epsilon = 0.02 at the chosen significance level alpha. |
critical_value_eps05 |
Critical value for epsilon = 0.05 at the chosen significance level alpha. |
reject_eps02 |
Logical, TRUE if the null is rejected for epsilon = 0.02. |
reject_eps05 |
Logical, TRUE if the null is rejected for epsilon = 0.05. |
alpha |
Significance level. |
m |
Bandwidth parameter m. |
n |
Sample size. |
Qu, Z. (2011). A Test Against Spurious Long Memory. Journal of Business & Economic Statistics, 29(3), 423-438.
data(RV5min) result <- Longmemorytest(log(RV5min)) # Simulated example: ARFIMA(0,d,0) with d = 0.3 (true long memory) set.seed(123) n <- 2000 d0 <- 0.3 e <- rnorm(n) x <- fracdiff::fracdiff.sim(n, d = d0)$series # Apply the test (null = true long memory) out <- Longmemorytest(x, alpha = 0.05) out$reject_eps02 # typically FALSE out$d_estimate # Example: Spurious long memory due to a structural break set.seed(123) n <- 2000 x <- c(rnorm(n/2, 0, 1), rnorm(n/2, 2, 1)) # one-time mean shift out <- Longmemorytest(x, alpha = 0.05) out$reject_eps02 out$reject_eps05data(RV5min) result <- Longmemorytest(log(RV5min)) # Simulated example: ARFIMA(0,d,0) with d = 0.3 (true long memory) set.seed(123) n <- 2000 d0 <- 0.3 e <- rnorm(n) x <- fracdiff::fracdiff.sim(n, d = d0)$series # Apply the test (null = true long memory) out <- Longmemorytest(x, alpha = 0.05) out$reject_eps02 # typically FALSE out$d_estimate # Example: Spurious long memory due to a structural break set.seed(123) n <- 2000 x <- c(rnorm(n/2, 0, 1), rnorm(n/2, 2, 1)) # one-time mean shift out <- Longmemorytest(x, alpha = 0.05) out$reject_eps02 out$reject_eps05
RV5min: realized volatility for Japanese Yen/USD spot exchange rates from Dec 1st, 1986 to Jun 30th, 1999
data(RV5min)data(RV5min)
Numeric vector