# mosum: MOSUM procedure for multiple change point estimation In mosum: Moving Sum Based Procedures for Changes in the Mean

## Description

Computes the MOSUM detector, detects (multiple) change points and estimates their locations.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```mosum( x, G, G.right = G, var.est.method = c("mosum", "mosum.min", "mosum.max", "custom"), var.custom = NULL, boundary.extension = TRUE, threshold = c("critical.value", "custom"), alpha = 0.1, threshold.custom = NULL, criterion = c("eta", "epsilon"), eta = 0.4, epsilon = 0.2, do.confint = FALSE, level = 0.05, N_reps = 1000 ) ```

## Arguments

 `x` input data (a `numeric` vector or an object of classes `ts` and `timeSeries`) `G` an integer value for the moving sum bandwidth; `G` should be less than `length(n)/2`. Alternatively, a number between `0` and `0.5` describing the moving sum bandwidth relative to `length(x)` can be given `G.right` if `G.right != G`, the asymmetric bandwidth `(G, G.right)` will be used; if `max(G, G.right)/min(G, G.right) > 4`, a warning message is generated `var.est.method` how the variance is estimated; possible values are `"mosum"`both-sided MOSUM variance estimator `"mosum.min"`minimum of the sample variance estimates from the left and right summation windows `"mosum.max"`maximum of the sample variance estimates from the left and right summation windows `"custom"`a vector of `length(x)` is to be parsed by the user; use `var.custom` in this case to do so `var.custom` a numeric vector (of the same length as `x`) containing local estimates of the variance or long run variance; use iff `var.est.method = "custom"` `boundary.extension` a logical value indicating whether the boundary values should be filled-up with CUSUM values `threshold` string indicating which threshold should be used to determine significance. By default, it is chosen from the asymptotic distribution at the given significance level `alpha`. Alternatively it is possible to parse a user-defined numerical value with `threshold.custom` `alpha` a numeric value for the significance level with `0 <= alpha <= 1`; use iff `threshold = "critical.value"` `threshold.custom` a numeric value greater than 0 for the threshold of significance; use iff `threshold = "custom"` `criterion` string indicating how to determine whether each point `k` at which MOSUM statistic exceeds the threshold is a change point; possible values are `"eta"`there is no larger exceeding in an `eta*G` environment of `k` `"epsilon"``k` is the maximum of its local exceeding environment, which has at least size `epsilon*G` `eta` a positive numeric value for the minimal mutual distance of changes, relative to moving sum bandwidth (iff `criterion = "eta"`) `epsilon` a numeric value in (0,1] for the minimal size of exceeding environments, relative to moving sum bandwidth (iff `criterion = "epsilon"`) `do.confint` flag indicating whether to compute the confidence intervals for change points `level` use iff `do.confint = TRUE`; a numeric value (`0 <= level <= 1`) with which `100(1-level)%` confidence interval is generated `N_reps` use iff `do.confint = TRUE`; number of bootstrap replicates to be generated

## Value

S3 object of class `mosum.cpts`, which contains the following fields:

 `x` input data `G.left, G.right` left and right summation bandwidths `var.est.method, var.custom,boundary.extension` input parameters `stat` a series of MOSUM statistic values; the first `G` and last `G.right` values are `NA` iff `boundary.extension = FALSE` `rollsums` a series of MOSUM detector values; equals `stat*sqrt(var.estimation)` `var.estimation` the local variance estimated according to `var.est.method` `threshold, alpha, threshold.custom` input parameters `threshold.value` threshold value of the corresponding MOSUM test `criterion, eta, epsilon` input parameters `cpts` a vector containing the estimated change point locations `cpts.info` data frame containing information about change point estimators including detection bandwidths, asymptotic p-values for the corresponding MOSUM statistics and (scaled) size of jumps `do.confint` input parameter `ci` S3 object of class `cpts.ci` containing confidence intervals for change points iff `do.confint=TRUE`

## References

A. Meier, C. Kirch and H. Cho (2021) mosum: A Package for Moving Sums in Change-point Analysis. Journal of Statistical Software, Volume 97, Number 8, pp. 1-42. <doi:10.18637/jss.v097.i08>.

B. Eichinger and C. Kirch (2018) A MOSUM procedure for the estimation of multiple random change-points. Bernoulli, Volume 24, Number 1, pp. 526-564.

H. Cho and C. Kirch (2021) Bootstrap confidence intervals for multiple change points based on moving sum procedures. arXiv preprint arXiv:2106.12844.

## Examples

 ```1 2 3 4``` ```x <- testData(lengths = rep(100, 3), means = c(0, 5, -2), sds = rep(1, 3), seed = 1234)\$x m <- mosum(x, G = 40) plot(m) summary(m) ```

### Example output ```Warning message:
no DISPLAY variable so Tk is not available
change-points estimated at alpha = 0.1 according to eta-criterion
with eta = 0.4 and mosum variance estimate:

cpts   G.left   G.right   p.value    jump
1    100       40        40         0   5.054
2    200       40        40         0   6.028
```

mosum documentation built on June 25, 2021, 5:08 p.m.