Title: | Testing for Structural Breaks under Long Memory and Testing for Changes in Persistence |
---|---|
Description: | Test procedures and break point estimators for persistent processes that exhibit structural breaks in mean or in persistence. On the one hand the package contains the most popular approaches for testing whether a time series exhibits a break in persistence from I(0) to I(1) or vice versa, such as those of Busetti and Taylor (2004) and Leybourne, Kim, and Taylor (2007). The approach by Martins and Rodrigues (2014), which allows to detect changes from I(d1) to I(d2) with d1 and d2 being non-integers, is included as well. In case the tests reject the null of constant persistence, various breakpoint estimators are available to detect the point of the break as well as the order of integration in the two regimes. On the other hand the package contains the most popular approaches to test for a change-in-mean of a long-memory time series, which were recently reviewed by Wenger, Leschinski, and Sibbertsen (2018). These include memory robust versions of the CUSUM, sup-Wald, and Wilcoxon type tests. The tests either utilize consistent estimates of the long-run variance or a self normalization approach in their test statistics. Betken (2016) <doi:10.1111/jtsa.12187> Busetti and Taylor (2004) <doi:10.1016/j.jeconom.2003.10.028> Dehling, Rooch and Taqqu (2012) <doi:10.1111/j.1467-9469.2012.00799.x> Harvey, Leybourne and Taylor (2006) <doi:10.1016/j.jeconom.2005.07.002> Horvath and Kokoszka (1997) <doi:10.1016/S0378-3758(96)00208-X> Hualde and Iacone (2017) <doi:10.1016/j.econlet.2016.10.014> Iacone, Leybourne and Taylor (2014) <doi:10.1111/jtsa.12049> Leybourne, Kim, Smith, and Newbold (2003) <doi:10.1111/1368-423X.t01-1-00110> Leybourne and Taylor (2004) <doi:10.1016/j.econlet.2003.12.015> Leybourne, Kim, and Taylor (2007): <doi:10.1111/j.1467-9892.2006.00517.x> Martins and Rodrigues (2014) <doi:10.1016/j.csda.2012.07.021> Shao (2011) <doi:10.1111/j.1467-9892.2010.00717.x> Sibbertsen and Kruse (2009) <doi:10.1111/j.1467-9892.2009.00611.x> Wang (2008) <doi:10.1080/00949650701216604> Wenger, Leschinski and Sibbertsen (2018) <doi:10.1016/j.econlet.2017.12.007>. |
Authors: | Janis Becker [aut], Kai Wenger [aut, cre] |
Maintainer: | Kai Wenger <[email protected]> |
License: | GPL-2 |
Version: | 1.1.1 |
Built: | 2025-02-01 06:15:11 UTC |
Source: | https://github.com/kaiwenger/memochange |
This function estimates the location where the investigated time series exhibits a break in persistence. It requires knowledge of the direction of the break, i.e. an increase or decrease in persistence. This needs to be determined beforehand using one of the various persistence change tests provided in this package.
BP_estim(x, trend = c("none", "linear"), tau = 0.2, type = c("BT", "LKT", "LKSN", "MR"), direction = c("01", "10"), d_estim = c("ELW", "GPH"), d_bw = 0.7, m = 0, serial = c(FALSE, TRUE))
BP_estim(x, trend = c("none", "linear"), tau = 0.2, type = c("BT", "LKT", "LKSN", "MR"), direction = c("01", "10"), d_estim = c("ELW", "GPH"), d_bw = 0.7, m = 0, serial = c(FALSE, TRUE))
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
trend |
whether the time series exhibits a trend, |
tau |
the function searches in the interval |
type |
which type of break point estimator should be used, |
direction |
direction of the change in persistence, |
d_estim |
which estimator should be used to determine the order of integration in the two regimes, |
d_bw |
bandwidth used for estimating the order of integration d. Default is |
m |
Number of covariances used for the estimation of the long run variance when considering the LKT estimator. Default is |
serial |
boolean, indicating whether to account for serial correlation of the errors when considering the MR estimator. Default is |
The estimators BT and LKSN are only consistent for changes from I(0) to I(1) or vice versa, the LKT estimator is consistent for changes from stationary to nonstationary memory or vice versa (cf. also Sibbertsen and Kruse (2009)), and the MR estimator is consistent for changes in d in general.
Returns a list that contains break point, estimate of the order of integration in the two regimes (the memory parameter d) and standard deviation of this estimate.
Janis Becker
Leybourne, S., Kim, T., Smith, V., and Newbold, P. (2003): Tests for a change in persistence against the null of difference-stationarity. Econometrics Journal, 6, pp. 291-311.
Busetti, F. and Taylor, R. (2004): Tests of stationarity against a change in persistence. Journal of Econometrics, 123, pp. 33-66.
Leybourne, S., Kim, T., and Taylor, R. (2007): Cusum of squares-based tests for a change in persistence. Journal of Time Series Analysis, 28, pp. 408-433.
Martins, L.. and Rodrigues, P. (2014): Testing for persistence change in fractionally integrated models: An application to world inflation rates Cusum of squares-based tests for a change in persistence. Computational Statistics and Data Analysis, 76, pp. 502-522.
cusum_test
, LKSN_test
, MR_test
, ratio_test
.
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # estimate the break point BP_estim(series, trend="none", type="BT", direction="01", d_estim="ELW")
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # estimate the break point BP_estim(series, trend="none", type="BT", direction="01", d_estim="ELW")
This function performs a CUSUM test on a change-in-mean that is robust under long memory. It is based on the fractionally differenced series where the long-memory parameter is estimated by a consistent estimator. The function returns the test statistic as well as the p-value of the test.
CUSUM_simple(x, d)
CUSUM_simple(x, d)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
d |
integer that specifies the long-memory parameter. |
Returns a numeric vector containing the test statistic and the p-value of the test.
Kai Wenger
Wenger, K. and Leschinski, C. and Sibbertsen, P. (2018): A simple test on structural change in long-memory time series. Economics Letters, 136, pp. 90-94.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series without a change in mean tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series CUSUM_simple(tseries, d_est) CUSUM_simple(tseries2, d_est2) # For the series with no change in mean the test does not # reject the null hypothesis of a constant mean across time # at any reasonable significance level. # For the series with a change in mean the test rejects the # null hypothesis at a 5% significance level.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series without a change in mean tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series CUSUM_simple(tseries, d_est) CUSUM_simple(tseries2, d_est2) # For the series with no change in mean the test does not # reject the null hypothesis of a constant mean across time # at any reasonable significance level. # For the series with a change in mean the test rejects the # null hypothesis at a 5% significance level.
This function performs a cusum-type test for a change in persistence as suggested by Leybourne, Taylor, and Kim (2006) and extended by Sibbertsen and Kruse (2009). Under the null hypothesis the time series is nonstationary throughout and under the alternative a change from nonstationary to stationary or vice versa has occured.
cusum_test(x, trend = c("none", "linear"), tau = 0.2, type = c("LKT", "SK"), m = 0, simu = 0, M = 10000)
cusum_test(x, trend = c("none", "linear"), tau = 0.2, type = c("LKT", "SK"), m = 0, simu = 0, M = 10000)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
trend |
whether the time series exhibits a trend, |
tau |
the function tests in the interval |
type |
which type of cusum test should be performed, |
m |
Number of covariances used for the estimation of the long run variance. Default is |
simu |
whether critical values should be simulated or interpolated, |
M |
number of replications in case critical values should be simulated. Default is |
Leybourne, Taylor, and Kim (2006) introduced a cusum-type test that is able to identify when time series exhibit changes in persistence. Under the null hypothesis, the series is throughout I(1), i.e. nonstationary. Under the alternative the series exhibits a break either from I(0) to I(1) or vice versa. Sibbertsen and Kruse (2009) extended the test such that under the null hypothesis the time series is I(d) throughout, with d>1/2 and under the alternative a change from I(d1) to I(d2), where d1<1/2 and 1/2<d2<3/2, or vice versa has occured. While the test statistic remains the same, the critical values of the extended test change as they depend on the order of integration. Furthermore, the procedure by SK integrates the series if d is estimated to be smaller than 1/2. This allows to overcome the problem of the approach by LKT which is that is has a degenerated limiting distribution when the series is stationary. To determine the order of integration (the memory parameter d) the semiparametric estimator by Geweke and Porter-Hudak (1983) is used.
The critical values of the tests vary with sample size and d. If simu=0
, the critical values provided
are based on linear interpolation of the critical values simulated by Leybourne, Taylor, and Kim (2006) respectively the response curves by Sibbertsen and Kruse (2009).
These are, however, only valid for tau=0.2
and m=0
.
In case that non-default values are chosen for tau
or m
, it is recommended to set simu=1
which means that critical values are simulated based on the given data using M replications.
Caution, for a time series of length T=100
and M=10,000
replications this takes approximately thirty minutes with increasing duration for higher T or M.
It should be noted, however, that M smaller than 10,000 make the results unreliable.
Returns a matrix that consists of test statistic and critical values for testing against a change from nonstationary to stationary, stationary to nonstationary, and against a change in an unknown direction.
Janis Becker
Leybourne, S., Kim, T., and Taylor, R. (2007): Cusum of squares-based tests for a change in persistence. Journal of Time Series Analysis, 28, pp. 408-433.
Sibbertsen, P. and Kruse, R. (2009): Testing for a break in persistence under long-range dependencies. Journal of Time Series Analysis, 30, pp. 263-285.
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # test for a break in persistence cusum_test(series, trend="none", type="SK")
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # test for a break in persistence cusum_test(series, trend="none", type="SK")
This function performs a family of CUSUM tests for a change-in-mean that are robust under long memory. They apply non-parametric kernel-based fixed-b and fixed-m long-run variance estimators in the denominator of the test statistics. The function returns the test statistic as well as critical values.
CUSUMfixed(x, d, procedure, bandw, tau = 0.15)
CUSUMfixed(x, d, procedure, bandw, tau = 0.15)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
d |
integer that specifies the long-memory parameter. |
procedure |
string that specifies whether the CUSUM fixed-b or fixed-m type A or type B tests are used. It can be chosen between
|
bandw |
integer that determines the bandwidth used for estimation of the long-run variance. For the fixed-b tests |
tau |
integer that defines the search area, which is |
Note that the critical values are generated for tau=0.15
using the Bartlett kernel for the fixed-b tests or averaging the first m periodogram
ordinates (which corresponds to the Daniell kernel) for the fixed-m tests.
Returns a numeric vector containing the test statistic and the corresponding critical values of the test.
Kai Wenger
Wenger, K. and Leschinski, C. (2019): Change-in-mean tests in long-memory time series: a review of recent developments. AStA Advances in Statistical Analysis, 103:2, pp. 237-256.
Hualde, J. and Iacone, F. (2017): Fixed bandwidth asymptotics for the studentized mean of fractionally integrated processes. Economics Letters, 150, pp. 39-43.
Andrews, D. W. K. (1993): Tests for Parameter Instability and Structural Change With Unknown Change Point. Econometrica, 61, pp. 821-856.
CUSUMLM
, CUSUM_simple
, fixbsupw
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the different types of the test on both time series CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedb_typeA", bandw=0.1) CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedb_typeB", bandw=0.1) CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedm_typeA", bandw=10) CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedm_typeB", bandw=10) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedb_typeA", bandw=0.1) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedb_typeB", bandw=0.1) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedm_typeA", bandw=10) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedm_typeB", bandw=10) # For the series with no change in mean all tests do not reject # the null hypothesis of a constant mean across time at # any reasonable significance level. # For the series with a change in mean all tests reject the # null hypothesis at a 1% significance level.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the different types of the test on both time series CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedb_typeA", bandw=0.1) CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedb_typeB", bandw=0.1) CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedm_typeA", bandw=10) CUSUMfixed(tseries, d=d_est, procedure="CUSUMfixedm_typeB", bandw=10) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedb_typeA", bandw=0.1) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedb_typeB", bandw=0.1) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedm_typeA", bandw=10) CUSUMfixed(tseries2, d=d_est2, procedure="CUSUMfixedm_typeB", bandw=10) # For the series with no change in mean all tests do not reject # the null hypothesis of a constant mean across time at # any reasonable significance level. # For the series with a change in mean all tests reject the # null hypothesis at a 1% significance level.
This function performs a modified CUSUM test for a change-in-mean that is robust under long memory. It replaces the standardization as well as the long-run variance estimator compared to the standard CUSUM test. The function returns the test statistic as well as critical values.
CUSUMLM(x, d, delta, tau = 0.15)
CUSUMLM(x, d, delta, tau = 0.15)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
d |
integer that specifies the long-memory parameter. |
delta |
integer that determines the bandwidth that is used to estimate the constant |
tau |
integer that defines the search area, which is |
Note that the critical values are generated for tau=0.15
.
Returns a numeric vector containing the test statistic and the corresponding critical values of the test.
Kai Wenger
Wenger, K. and Leschinski, C. and Sibbertsen, P. (2018): Change-in-mean tests in long-memory time series: a review of recent developments. AStA Advances in Statistical Analysis, 103:2, pp. 237-256.
Wang, L. (2008): Change-in-mean problem for long memory time series models with applications. Journal of Statistical Computation and Simulation, 78:7, pp. 653-668.
Horvath, L. and Kokoszka, P. (1997): The effect of long-range dependence on change-point estimators. Journal of Statistical Planung and Inference, 64, pp. 57-81.
Andrews, D. W. K. (1993): Tests for Parameter Instability and Structural Change With Unknown Change Point. Econometrica, 61, pp. 821-856.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series CUSUMLM(tseries, delta=0.65, d=d_est) CUSUMLM(tseries2, delta=0.65, d=d_est2) # For the series with no change in mean the test does not # reject the null hypothesis of a constant mean across time # at any reasonable significance level. # For the series with a change in mean the test rejects the # null hypothesis at a 1% significance level.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series CUSUMLM(tseries, delta=0.65, d=d_est) CUSUMLM(tseries2, delta=0.65, d=d_est2) # For the series with no change in mean the test does not # reject the null hypothesis of a constant mean across time # at any reasonable significance level. # For the series with a change in mean the test rejects the # null hypothesis at a 1% significance level.
This function performs a sup-Wald test on a change-in-mean, which is standardized by a non-parametric kernel-based long-run variance estimator. Therefore, the test is robust under long-memory. The function returns the test statistic as well as critical values.
fixbsupw(x, d, bandw = 0.1, tau = 0.15)
fixbsupw(x, d, bandw = 0.1, tau = 0.15)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
d |
integer that specifies the long-memory parameter. |
bandw |
integer that determines the bandwidth parameter for the long-run variance estimator. It can take values in the range |
tau |
integer that defines the search area, which is |
Note that the critical values are generated for tau=0.15
using the Bartlett kernel.
Returns a numeric vector containing the test statistic and the corresponding critical values of the test.
Kai Wenger
Iacone, F. and Leybourne, S. J. and Taylor, R. A. M. (2014): A fixed-b Test for a Break in Level at an unknown Time under Fractional Integration. Journal of Time Series Analysis, 35, pp. 40-54.
Andrews, D. W. K. (1993): Tests for Parameter Instability and Structural Change With Unknown Change Point. Econometrica, 61, pp. 821-856.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series fixbsupw(tseries, d=d_est) fixbsupw(tseries2, d=d_est2) # For the series with no change in mean the test does not reject # the null hypothesis of a constant mean across time at any # reasonable significance level. # For the series with a change in mean the test rejects the # null hypothesis at a 1% significance level.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series fixbsupw(tseries, d=d_est) fixbsupw(tseries2, d=d_est2) # For the series with no change in mean the test does not reject # the null hypothesis of a constant mean across time at any # reasonable significance level. # For the series with a change in mean the test rejects the # null hypothesis at a 1% significance level.
This function performs the locally best invariant test against a change in persistence as suggested by Busetti and Taylor (2004). Under the null hypothesis the time series is I(0) throughout and under the alternative a change from either I(1) to I(0) or I(0) to I(1) has occured.
LBI_test(x, trend = c("none", "linear"), tau = 0.2, statistic = c("mean", "max", "exp"), simu = 0, M = 10000)
LBI_test(x, trend = c("none", "linear"), tau = 0.2, statistic = c("mean", "max", "exp"), simu = 0, M = 10000)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
trend |
whether the time series exhibits a trend, |
tau |
the function tests in the interval |
statistic |
which type of test statistic should be used, |
simu |
whether critical values should be simulated or interpolated, |
M |
number of replications in case critical values should be simulated. Default is |
The critical values of the tests vary with the sample size. If simu=0
, the critical values provided
are based on linear interpolation of the critical values simulated by Busetti and Taylor (2004). These are, however, only valid for tau=0.2
.
In case that another value is chosen for tau
, it is recommended to set simu=1
which means that critical values are simulated based on the given data using M replications.
For a time series of length T=100
and M=10,000
replications this takes approximately five minutes with increasing duration for higher T or M.
It should be noted, however, that M smaller than 10,000 make the results unreliable.
Returns a matrix that consists of test statistic and critical values (corresponding to alpha=0.1,0.05,0.01
) for testing against a change from I(1) to I(0), I(0) to I(1), and against a change in an unknown direction.
Janis Becker
Busetti, F. and Taylor, R. (2004): Tests of stationarity against a change in persistence. Journal of Econometrics, 123, pp. 33-66.
cusum_test
, LKSN_test
, MR_test
, ratio_test
.
set.seed(410) # generate dummy-data series <- c(rnorm(100), cumsum(rnorm(100))) # test for a break in persistence LBI_test(series, trend="none", statistic="mean")
set.seed(410) # generate dummy-data series <- c(rnorm(100), cumsum(rnorm(100))) # test for a break in persistence LBI_test(series, trend="none", statistic="mean")
This function performs the DF-type test against a change in persistence as suggested by Leybourne, Kim, Smith, and Newbold (2003). Under the null hypothesis the time series is I(1) throughout and under the alternative a change from either I(1) to I(0) or I(0) to I(1) has occured.
LKSN_test(x, trend = c("none", "linear"), tau = 0.2, lmax = 0, simu = 0, M = 10000)
LKSN_test(x, trend = c("none", "linear"), tau = 0.2, lmax = 0, simu = 0, M = 10000)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
trend |
whether the time series exhibits a trend, |
tau |
the function tests in the interval |
lmax |
Maximum number of lagged differences to be included in the test regression. Default is |
simu |
whether critical values should be simulated or interpolated, |
M |
number of replications in case critical values are simulated. Default is |
The critical values of the tests vary with the sample size. If simu=0
, the critical values provided
are based on linear interpolation of the critical values simulated by Leybourne, Kim, Smith, and Newbold (2003). These are, however, only valid for tau=0.2
and lmax=0
.
In case that non-default values are chosen for tau
or lmax
, it is recommended to set simu=1
which means that critical values are simulated based on the given data using M replications.
Caution, for a time series of length T=100
and M=10,000
replications this takes approximately thirty minutes with increasing duration for higher T or M.
It should be noted, however, that M smaller than 10,000 make the results unreliable.
Returns a matrix that consists of test statistic and critical values (corresponding to alpha=0.1,0.05
) for testing against a change from I(1) to I(0), I(0) to I(1), and against a change in an unknown direction.
Janis Becker
Leybourne, S., Kim, T., Smith, V., and Newbold, P. (2003): Tests for a change in persistence against the null of difference-stationarity. Econometrics Journal, 6, pp. 291-311.
cusum_test
, LBI_test
, MR_test
, ratio_test
.
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # test for a break in persistence LKSN_test(series, trend="none")
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # test for a break in persistence LKSN_test(series, trend="none")
Test procedures and break point estimators for persistent processes that exhibit structural breaks in mean or in persistence.
On the one hand, the package contains the most popular approaches for testing whether a time series exhibits a break in persistence from I(0) to I(1) or vice versa, such as those of Busetti and Taylor (2004) and Leybourne, Kim, and Taylor (2007).
The approach by Martins and Rodrigues (2014), which allows to detect changes from I(d1) to I(d2) with d1 and d2 being non-integers, is included as well.
In case the tests reject the null of constant persistence, various breakpoint estimators are available to detect the point of the break as well as the order of integration in the two regimes.
On the other hand, the package contains the most popular approaches to test for a change in mean in a long-memory time series, which were recently reviewed by Wenger, Leschinski, and Sibbertsen (2018).
These include memory robust versions of the CUSUM, sup-Wald, and Wilcoxon type tests. The tests either utilize consistent estimates of the long-run variance or a self normalization approach in their test statistics.
For details see the readme and vignettes in the corresponding GitHub repository (https://github.com/KaiWenger/memochange).
Kai Wenger <[email protected]>, Janis Becker
Andrews, D. W. K. (1993): Tests for Parameter Instability and Structural Change With Unknown Change Point. Econometrica, 61, pp. 821-856.
Betken, A. (2016): Testing for change-points in long-range dependent time series by means of a self-normalized wilcoxon test. Journal of Time Series Analysis, 37, pp. 785-908.
Busetti, F. and Taylor, R. (2004): Tests of stationarity against a change in persistence. Journal of Econometrics, 123, pp. 33-66.
Dehling, H. and Rooch, A. and Taqqu, M. S. (2012): Non-Parametric Change-Point Tests for Long-Range Dependent Data. Scandinavian Journal of Statistics, 40, pp. 153-173.
Harvey, D., Leybourne, S. and Taylor, R. (2006): Modified tests for a change in persistence. Journal of Econometrics, 134, pp. 441-469.
Horvath, L. and Kokoszka, P. (1997): The effect of long-range dependence on change-point estimators. Journal of Statistical Planung and Inference, 64, pp. 57-81.
Hualde, J. and Iacone, F. (2017): Fixed bandwidth asymptotics for the studentized mean of fractionally integrated processes. Economics Letters, 150, pp. 39-43.
Iacone, F. and Leybourne, S. J. and Taylor, R. A. M. (2014): A fixed-b Test for a Break in Level at an unknown Time under Fractional Integration. Journal of Time Series Analysis, 35, pp. 40-54.
Leybourne, S., Kim, T., Smith, V., and Newbold, P. (2003): Tests for a change in persistence against the null of difference-stationarity. Econometrics Journal, 6, pp. 291-311.
Leybourne, S. and Taylor, R. (2004): On tests for changes in persistence. Economics letters, 84, pp. 107-115.
Leybourne, S., Kim, T., and Taylor, R. (2007): Cusum of squares-based tests for a change in persistence. Journal of Time Series Analysis, 28, pp. 408-433.
Martins, L.. and Rodrigues, P. (2014): Testing for persistence change in fractionally integrated models: An application to world inflation rates Cusum of squares-based tests for a change in persistence. Computational Statistics and Data Analysis, 76, pp. 502-522.
Shao, X. (2011): A simple test of changes in mean in the possible presence of long-range dependence. Journal of Time Series Analysis, 32, pp. 598-606.
Sibbertsen, P. and Kruse, R. (2009): Testing for a break in persistence under long-range dependencies. Journal of Time Series Analysis, 30, pp. 263-285.
Wang, L. (2008): Change-in-mean problem for long memory time series models with applications. Journal of Statistical Computation and Simulation, 78:7, pp. 653-668.
Wenger, K. and Leschinski, C. and Sibbertsen, P. (2018): Change-in-mean tests in long-memory time series: a review of recent developments. AStA Advances in Statistical Analysis, 103:2, pp. 237-256.
Wenger, K. and Leschinski, C. and Sibbertsen, P. (2018): A simple test on structural change in long-memory time series. Economics Letters, 136, pp. 90-94.
BP_estim
, CUSUM_simple
,
cusum_test
, CUSUMfixed
, CUSUMLM
,
fixbsupw
, LBI_test
, LKSN_test
, MR_test
,
pb_sim
, ratio_test
, snsupwald
,
snwilcoxon
, wilcoxonLM
This function performs a LM-type test for a change in persistence as suggested by Martins and Rodrigues (2014). Under the null hypothesis the memory parameter d is constant over the sample. Under the alternative an increase or a decrease of the memory parameter has occured over time.
MR_test(x, trend = c("none", "linear"), tau = 0.2, statistic = c("squared", "standard"), simu = 0, M = 10000, serial = c(FALSE, TRUE))
MR_test(x, trend = c("none", "linear"), tau = 0.2, statistic = c("squared", "standard"), simu = 0, M = 10000, serial = c(FALSE, TRUE))
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
trend |
whether the time series exhibits a trend, |
tau |
the function tests in the interval |
statistic |
which type of test statistic should be used, |
simu |
whether critical values should be simulated or interpolated, |
M |
number of replications in case critical values should be simulated. Default is |
serial |
boolean, indicating whether to account for serial correlation of the errors. Default is |
The critical values of the tests vary with sample size and memory parameter d. If simu=0
, the critical values provided
are based on linear interpolation of the critical values simulated by Martins and Rodrigues (2014). These are, however, only valid for tau=0.2
and serial=FALSE
.
In case that non-default values are chosen for tau
or serial
, it is recommended to set simu=1
which means that critical values are simulated based on the given data using M replications.
Caution, for a time series of length T=750
and M=10,000
replications this takes approximately twelve hours with increasing duration for higher T or M.
It should be noted, however, that M smaller than 10,000 make the results unreliable.
Returns a matrix that consists of test statistic and critical values (corresponding to alpha=0.1,0.05,0.01
) for testing against an increase in memory, against a decrease in memory, and against a change in an unknown direction.
Janis Becker
Martins, L.. and Rodrigues, P. (2014): Testing for persistence change in fractionally integrated models: An application to world inflation rates. Computational Statistics and Data Analysis, 76, pp. 502-522.
cusum_test
, LBI_test
, LKSN_test
, ratio_test
.
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # test for a break in persistence MR_test(series, trend="none", statistic="squared")
set.seed(410) # generate dummy-data series <- c(rnorm(200), cumsum(rnorm(200))) # test for a break in persistence MR_test(series, trend="none", statistic="squared")
This function simulates a fractional white noise process that exhibits a break in persistence using FI.sim
from the LongMemoryTS
package. In the first part of the series the noise is integrated with order d_1
and in the second part with order d_2
.
pb_sim(T, tau, trend = c("none", "linear"), tp = 0, d1, d2, mean = 0, var = 1)
pb_sim(T, tau, trend = c("none", "linear"), tp = 0, d1, d2, mean = 0, var = 1)
T |
length of the time series. |
tau |
break fraction, |
trend |
whether the time series exhibits a trend, |
tp |
trend parameter, |
d1 |
order of integration of the first part of the series. |
d2 |
order of integration of the second part of the series. |
mean |
mean of the series. Default is |
var |
variance of the innovations. Default is |
Returns a vector containing the simulated time series.
Janis Becker
set.seed(410) # generate persistence-break time series series <- pb_sim(500, 0.5, "none", d1=0.2, d2=0.8, mean=0, var=1) # plot generated series stats::ts.plot(series)
set.seed(410) # generate persistence-break time series series <- pb_sim(500, 0.5, "none", d1=0.2, d2=0.8, mean=0, var=1) # plot generated series stats::ts.plot(series)
This function performs a ratio-based test against a change in persistence. Under the null hypothesis the time series is I(0) throughout and under the alternative a change from either I(1) to I(0) or I(0) to I(1) has occured.
ratio_test(x, trend = c("none", "linear"), tau = 0.2, statistic = c("mean", "max", "exp"), type = c("BT", "LT", "HLT", "HLTmin"), m = 0, z = 9, simu = 0, M = 10000)
ratio_test(x, trend = c("none", "linear"), tau = 0.2, statistic = c("mean", "max", "exp"), type = c("BT", "LT", "HLT", "HLTmin"), m = 0, z = 9, simu = 0, M = 10000)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
trend |
whether the time series exhibits a trend, |
tau |
the function tests in the interval |
statistic |
which type of test statistic should be used, |
type |
which type of ratio test should be performed, |
m |
Number of covariances used for the estimation of the long run variance if |
z |
Number of polynomials used if |
simu |
whether critical values should be simulated or interpolated, |
M |
number of replications in case critical values should be simulated. Default is |
Busetti and Taylor (2004) (BT) introduced a test that is able to identify when time series exhibit changes in persistence. Under the null hypothesis, the series is constant I(0), i.e. stationary. Under the alternative the series exhibits a break either from I(0) to I(1) or I(1) to I(0). As the test is oversized for weakly dependent time series, Leybourne and Taylor (2004) (LT) standardized the test statistic by an estimate of the long run variance using m lags. Another problem is that constant I(1) processes are neither covered under the null nor the alternative. Here, the test often rejects the null although no change in persistence occured. Harvey, Leybourne, and Taylor (2006) (HLT) introduced a modification where they multiply the test statistic by a unit root test. This allows the test statistic to have the same critical values under both constant I(0) and constant I(1). It should be noted, however, that only the critical values are identical, the distribution is highly irregular.
The critical values of the tests vary with the sample size. If simu=0
, the critical values provided
are based on linear interpolation of the critical values simulated by Harvey, Leybourne, and Taylor (2006). These are, however, only valid for tau=0.2
, m=0
, and z=9
.
In case that non-default values are chosen for tau
, m
, or z
, it is recommended to set simu=1
which means that critical values are simulated based on the given data using M replications.
Caution, for a time series of length T=100
and M=10,000
replications this takes approximately fifteen minutes with increasing duration for higher T or M.
It should be noted, however, that M smaller than 10,000 make the results unreliable.
Returns a matrix that consists of test statistic and critical values (corresponding to alpha=0.1,0.05,0.01
) for testing against a change from I(1) to I(0), I(0) to I(1), and against a change in an unknown direction.
Janis Becker
Busetti, F. and Taylor, R. (2004): Tests of stationarity against a change in persistence. Journal of Econometrics, 123, pp. 33-66.
Leybourne, S. and Taylor, R. (2004): On tests for changes in persistence. Economics letters, 84, pp. 107-115.
Harvey, D., Leybourne, S. and Taylor, R. (2006): Modified tests for a change in persistence. Journal of Econometrics, 134, pp. 441-469.
cusum_test
, LBI_test
, LKSN_test
, MR_test
.
set.seed(410) # generate dummy-data series <- c(rnorm(100), cumsum(rnorm(100))) # test for a break in persistence ratio_test(series)
set.seed(410) # generate dummy-data series <- c(rnorm(100), cumsum(rnorm(100))) # test for a break in persistence ratio_test(series)
This function performs a sup Wald test for a change-in-mean that is robust under long memory. In contrast to a standard sup Wald test it applies a self-normalization approach to estimate the long-run variance. The function returns the test statistic as well as critical values.
snsupwald(x, d, tau = 0.15)
snsupwald(x, d, tau = 0.15)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
d |
integer that specifies the long-memory parameter. |
tau |
integer that defines the search area, which is |
Note that the critical values are generated for tau=0.15
.
Returns a numeric vector containing the test statistic and the corresponding critical values of the test.
Kai Wenger
Wenger, K. and Leschinski, C. and Sibbertsen, P. (2018): Change-in-mean tests in long-memory time series: a review of recent developments. AStA Advances in Statistical Analysis, 103:2, pp. 237-256.
Shao, X. (2011): A simple test of changes in mean in the possible presence of long-range dependence. Journal of Time Series Analysis, 32, pp. 598-606.
Andrews, D. W. K. (1993): Tests for Parameter Instability and Structural Change With Unknown Change Point. Econometrica, 61, pp. 821-856.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series snsupwald(tseries, d=d_est) snsupwald(tseries2, d=d_est2) # For the series with no change in mean the test does not reject the # null hypothesis of a constant mean across time at any reasonable # significance level. # For the series with a change in mean the test rejects the null hypothesis # at a 1% significance level.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local # Whittle approach. The bandwidth to estimate d is chosen # as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series snsupwald(tseries, d=d_est) snsupwald(tseries2, d=d_est2) # For the series with no change in mean the test does not reject the # null hypothesis of a constant mean across time at any reasonable # significance level. # For the series with a change in mean the test rejects the null hypothesis # at a 1% significance level.
This function performs a Wilcoxon test for a change-in-mean that is robust under long memory. In contrast to a standard Wilcoxon test it applies a self-normalization approach to estimate the long-run variance. The function returns the test statistic as well as critical values.
snwilcoxon(x, d, tau = 0.15)
snwilcoxon(x, d, tau = 0.15)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
d |
integer that specifies the long-memory parameter. |
tau |
integer that defines the search area, which is |
Note that the critical values are generated for tau=0.15
. Furthermore, it is assumed that we have a 1st-order Hermite process. For details see Betken (2016).
Returns a numeric vector containing the test statistic and the corresponding critical values of the test.
Kai Wenger
Wenger, K. and Leschinski, C. and Sibbertsen, P. (2018): Change-in-mean tests in long-memory time series: a review of recent developments. AStA Advances in Statistical Analysis, 103:2, pp. 237-256.
Betken, A. (2016): Testing for change-points in long-range dependent time series by means of a self-normalized wilcoxon test. Journal of Time Series Analysis, 37, pp. 785-908.
Andrews, D. W. K. (1993): Tests for Parameter Instability and Structural Change With Unknown Change Point. Econometrica, 61, pp. 821-856.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local Whittle approach. # The bandwidth to estimate d is chosen as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series snwilcoxon(tseries, d=d_est) snwilcoxon(tseries2, d=d_est2) # For the series with no change in mean the test does not reject the null hypothesis # of a constant mean across time at any reasonable significance level. # For the series with a change in mean the test rejects the null hypothesis # at a 1% significance level.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local Whittle approach. # The bandwidth to estimate d is chosen as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series snwilcoxon(tseries, d=d_est) snwilcoxon(tseries2, d=d_est2) # For the series with no change in mean the test does not reject the null hypothesis # of a constant mean across time at any reasonable significance level. # For the series with a change in mean the test rejects the null hypothesis # at a 1% significance level.
This function performs a Wilcoxon type test for a change-in-mean that is robust under long memory. It applies a consistent estimator of the long-run variance under long memory and uses a different normalization compared to a standard Wilcoxon test. The function returns the test statistic as well as critical values.
wilcoxonLM(x, d, tau = 0.15)
wilcoxonLM(x, d, tau = 0.15)
x |
the univariate numeric vector to be investigated. Missing values are not allowed. |
d |
integer that specifies the long-memory parameter. |
tau |
integer that defines the search area, which is |
Note that the critical values are generated for tau=0.15
.
Returns a numeric vector containing the test statistic and the corresponding critical values of the test.
Kai Wenger
Wenger, K. and Leschinski, C. and Sibbertsen, P. (2018): Change-in-mean tests in long-memory time series: a review of recent developments. AStA Advances in Statistical Analysis, 103:2, pp. 237-256.
Dehling, H. and Rooch, A. and Taqqu, M. S. (2012): Non-Parametric Change-Point Tests for Long-Range Dependent Data. Scandinavian Journal of Statistics, 40, pp. 153-173.
Andrews, D. W. K. (1993): Tests for Parameter Instability and Structural Change With Unknown Change Point. Econometrica, 61, pp. 821-856.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local Whittle approach. # The bandwidth to estimate d is chosen as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series wilcoxonLM(tseries, d=d_est) wilcoxonLM(tseries2, d=d_est2) # For the series with no change in mean the test does not reject the null hypothesis # of a constant mean across time at any reasonable significance level. # For the series with a change in mean the test rejects the null hypothesis # at a 5% significance level.
# set model parameters T <- 500 d <- 0.2 set.seed(410) # generate a fractionally integrated (long-memory) time series tseries <- fracdiff::fracdiff.sim(n=T, d=d)$series # generate a fractionally integrated (long-memory) time series # with a change in mean in the middle of the series changep <- c(rep(0,T/2), rep(1,T/2)) tseries2 <- tseries+changep # estimate the long-memory parameter of both series via local Whittle approach. # The bandwidth to estimate d is chosen as T^0.65, which is usual in literature d_est <- LongMemoryTS::local.W(tseries, m=floor(1+T^0.65))$d d_est2 <- LongMemoryTS::local.W(tseries2, m=floor(1+T^0.65))$d # perform the test on both time series wilcoxonLM(tseries, d=d_est) wilcoxonLM(tseries2, d=d_est2) # For the series with no change in mean the test does not reject the null hypothesis # of a constant mean across time at any reasonable significance level. # For the series with a change in mean the test rejects the null hypothesis # at a 5% significance level.