changerob: Robust Change Point Detection

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Robust and non robust tests for changes in location and scale based on U-statistics and U-quantiles under short range dependence. See Dehling et al. (2013) and Dehling et al. (2015) for details.

Usage

1
2
3
4
5
6
7
8
changerob(x, property = c("location", "scale"),
          test = c("HL", "Wilcoxon", "CUSUM"), conf.level = 0.95,
          alternative = c("two.sided", "increase", "decrease"),
          var.method = c("window", "acf", "acfextra"), overlapping = TRUE,
          shiftcorrect = TRUE, borderN = 10, plot = FALSE, ...)
          
## S3 method for class 'changerob'
plot(x, ...)

Arguments

x

numeric vector or univariate time series object.

property

character string indicating whether one tests against a change in location ("location") or scale ("scale").

test

character string defining the applied change point test. Possible are the nonrobust cusum test ("CUSUM"), the Wilcoxon test ("wilcox") and the Hodges-Lehmann test ("HL", the default). See Details for more information about the tests.

conf.level

numerical value indicating the confidence level of the test.

alternative

character string which specifies the alternative hypothesis.

var.method

character string defining the estimator of the long run variance, see Details.

overlapping

logical value indicating whether block sums should be distinct or overlapping. Only relevant if var.method = "window", see Details.

shiftcorrect

logical value. If TRUE, the estimation of the long run variance considers a change in location by first estimating the change point and then subtracting the estimated jump height from the second part of the time series. This should considerably improve the power of the test.

borderN

integer value. If shiftcorrect = TRUE, the change point for the estimation of the log run variance is not searched below the first and last borderN observations.

plot

logical value. If TRUE, a plot with the trajectory of the test statistic including confidence bands is drawn.

...

further arguments passed to the respective internal functions (for function changerob) or to the plotting function (for the corresponding plot method).

Details

The cusum-type test procedures are originally designed to test for a constant location but are also able to detect changes in scale using the following transformation

\tilde{x}_i = log(|x_i-median(x)|)

of the original time series x. As usual cusum type tests are very powerful if there is one structural break but might suffer in case of multiple changes, especially if they are in different directions.

There are three different tests implemented, which can be chosen by the argument test:

"CUSUM"

The usual Cusum test for a change in location is applied. Because of its sensitivity relative to particular large or small values one should be careful in case of outliers. Furthermore, the test loses a lot of power if the time series is heavy tailed. In both cases one should apply one of the two other tests.

"Wilcoxon"

One basically applies a two sample Mann-Whitney-Wilcoxon test for every possible change point and chooses a kind of maximal test statistic. The exact definition and details can be found in Dehling et al. (2013). By using ranks the tests gets less sensitive to outliers and does not suffer under heavy tailed distributions. Even under Gaussian processes the power of the test is not much worse than that of the cusum test. However, the test has little power against changes far from the center of the time series.

"HL"

One basically applies a two sample Hodges-Lehmann test for every possible change point and chooses a kind of maximal test statistic. The exact definition and details can be found in Dehling et al. (2015). As the Mann-Whitney-Wilcoxon test the Hodges-Lehmann test is less sensitive to outliers and does not suffer under heavy tailed distributions. The power of the test is in fact comparable to the Wilcoxon based one if the change point is in the center of the time series but outperforms the former if the change is nearer to the margins. The test procedure is computationally demanding and can take some time for large time series (with more than 2000 observations).

For the Hodges-Lehmann estimator one needs an additional estimation of the density at 0. See the help page of densdiff how to adjust tuning constants for that.

There are several possibilities to estimate the long run variance. Three of them with further variations are implemented and can be selected by the argument var.method:

"window"

One uses a subsampling estimator, which is based on centered absolute moments of block sums. One can either use distinct blocks, which is proposed by Carlstein (1986) and is applied if one sets overlapping = FALSE, or overlapping blocks, which is proposed by Peligrad and Shao (1995) and is applied in case of overlapping = TRUE. For more details how to set the block length and other tuning possibilities, see the help page of asymvar.window.

"acf"

One uses a kernel estimator, which weights estimated autocovariances. For more details how to set the bandwidth and other tuning possibilities, see the help page of asymvar.acf.

"acfextra"

One uses an extrapolation of the acf based on an AR fit. For more details how to set the bandwidth and other tuning possibilities, see the help page of asymvar.acfextra.

Value

Object with classes "changerob" and "htest" containing the following values:

statistic

the value of the test statistic. Under the null the test statistic follows, dependent of the chosen alternative, (asymptotically) a Kolmogorov Smirnov distribution.

p.value

the p-value of the test.

estimate

the estimated time of change.

null.value

the jump height of the at most one change point model, which is under the null hypothesis always 0.

alternative

a character string describing the alternative hypothesis.

method

a characters string indicating the chosen test.

data.name

a character giving the names of the data.

trajectory

the cumulative sum on which the tests are based on. Could be used for additional plots.

Author(s)

Roland Fried and Alexander Dürre

References

Carlstein, E. (1986): The use of subseries values for estimating the variance of a general statistic from a stationary sequence, The Annals of Statistics, vol. 14, 1171–1179, doi: 10.1214/aos/1176350057.

Dehling, H., Fried, R., Wendler, M. (2015): A robust method for shift detection in time series, preprint. arXiv 1506.03345

Dehling, H., Fried, R., Garcia, I., Wendler, M. (2013): Change-point detection under dependence based on two-sample U-statistics, preprint. arXiv 1304.2479

Peligrad, M., Shao, Q. (1995): Estimation of the Variance of Partial Sums for rho-Mixing Random Variables, Journal of Multivariate Analysis, vol. 152, 140–157, doi: 10.1006/jmva.1995.1008.

See Also

Further nonrobust change point tests are provided by the packages changepoint and strucchange.

changerob calls the subroutines changerob.cusum, changerob.wilcox or changerob.HL.

The long run variance is calculated by asymvar.window, asymvar.acf or asymvar.acfextra.

The density at 0 for the Hodges-Lehmann estimator is calculated by densdiff.

Examples

1
2
3
4
5
set.seed(1066)
tss <- arima.sim(model = list(ar = 0.3, ma = 0.5), n = 100)
output <- changerob(tss, plot = TRUE)
output
plot(output)

robts documentation built on May 2, 2019, 4:55 p.m.