Computes the MOSUM detector, detects (multiple) change points and estimates their locations.
mosum(
x,
G,
G.right = G,
var.est.method = c("mosum", "mosum.min", "mosum.max", "custom")[1],
var.custom = NULL,
boundary.extension = TRUE,
threshold = c("critical.value", "custom")[1],
alpha = 0.1,
threshold.custom = NULL,
criterion = c("eta", "epsilon")[1],
eta = 0.4,
epsilon = 0.2,
do.confint = FALSE,
level = 0.05,
N_reps = 1000
)
S3 object of class mosum.cpts
, which contains the following fields:
input data
left and right summation bandwidths
input parameters
a series of MOSUM statistic values; the first G
and last G.right
values are NA
iff boundary.extension = FALSE
a series of MOSUM detector values; equals stat*sqrt(var.estimation)
the local variance estimated according to var.est.method
input parameters
threshold value of the corresponding MOSUM test
input parameters
a vector containing the estimated change point locations
data frame containing information about change point estimators including detection bandwidths, asymptotic p-values for the corresponding MOSUM statistics and (scaled) size of jumps
input parameter
S3 object of class cpts.ci
containing confidence intervals for change points iff do.confint=TRUE
input data (a numeric
vector or an object of classes ts
and timeSeries
)
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
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
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
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"
a logical value indicating whether the boundary values should be filled-up with CUSUM values
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
a numeric value for the significance level with
0 <= alpha <= 1
; use iff threshold = "critical.value"
a numeric value greater than 0 for the threshold of significance;
use iff threshold = "custom"
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
a positive numeric value for the minimal mutual distance of
changes, relative to moving sum bandwidth (iff criterion = "eta"
)
a numeric value in (0,1] for the minimal size of exceeding
environments, relative to moving sum bandwidth (iff criterion = "epsilon"
)
flag indicating whether to compute the confidence intervals for change points
use iff do.confint = TRUE
; a numeric value (0 <= level <= 1
) with which
100(1-level)%
confidence interval is generated
use iff do.confint = TRUE
; number of bootstrap replicates to be generated
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 (2022) Bootstrap confidence intervals for multiple change points based on moving sum procedures. Computational Statistics & Data Analysis, Volume 175, pp. 107552.
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)
Run the code above in your browser using DataLab