Learn R Programming

changepoints (version 1.1.0)

WBS.uni.nonpar: Wild binary segmentation for univariate nonparametric change points detection.

Description

Perform wild binary segmentation for univariate nonparametric change points detection.

Usage

WBS.uni.nonpar(Y, s, e, Alpha, Beta, N, delta, level = 0)

Value

A list with the following structure:

S

A vector of estimated change points (sorted in strictly increasing order)

Dval

A vector of values of CUSUM statistic based on KS distance

Level

A vector representing the levels at which each change point is detected

Parent

A matrix with the starting indices on the first row and the ending indices on the second row

Arguments

Y

A numeric matrix of observations with horizontal axis being time, and vertical axis being multiple observations on each time point.

s

A integer scalar of starting index.

e

A integer scalar of ending index.

Alpha

A integer vector of starting indices of random intervals.

Beta

A integer vector of ending indices of random intervals.

N

A integer vector representing number of multiple observations on each time point.

delta

A positive integer scalar of minimum spacing.

level

Should be fixed as 0.

Author

Oscar Hernan Madrid Padilla, Haotian Xu

References

Padilla, Yu, Wang and Rinaldo (2021) <doi:10.1214/21-EJS1809>.

See Also

thresholdBS for obtaining change points estimation, tuneBSuninonpar for a tuning version.

Examples

Run this code
Y = t(as.matrix(c(rnorm(100, 0, 1), rnorm(100, 0, 10), rnorm(100, 0, 40))))
N = rep(1, 300)
M = 20
intervals = WBS.intervals(M = M, lower = 1, upper = ncol(Y))
temp = WBS.uni.nonpar(Y, 1, 300, intervals$Alpha, intervals$Beta, N, 5)
plot.ts(t(Y))
points(x = tail(temp$S[order(temp$Dval)], 4), y = Y[,tail(temp$S[order(temp$Dval)],4)], col = "red")
thresholdBS(temp, 2)

Run the code above in your browser using DataLab