Learn R Programming

changepoints (version 1.1.0)

WBS.multi.nonpar: Wild binary segmentation for multivariate nonparametric change points detection.

Description

Perform wild binary segmentation for multivariate nonparametric change points detection.

Usage

WBS.multi.nonpar(Y, W, s, e, Alpha, Beta, h, delta, level = 0)

Value

An object of class "BS", which is 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 with horizontal axis being time, and vertical axis being dimension.

W

A copy of the matrix Y, it can be Y itself.

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.

h

A numeric scalar of bandwidth parameter.

delta

A integer scalar of minimum spacing.

level

Should be fixed as 0.

Author

Oscar Hernan Madrid Padilla & Haotian Xu

References

Padilla, Yu, Wang and Rinaldo (2019) <arxiv:1910.13289>.

See Also

thresholdBS for obtain change points estimation, tuneBSmultinonpar for a tuning version.

Examples

Run this code
n = 70
v = c(floor(n/3), 2*floor(n/3)) # location of change points
p = 4
Y = matrix(0, p, n) # matrix for data
mu0 = rep(0, p) # mean of the data
mu1 = rep(0, p)
mu1[1:floor(p/2)] = 2
Sigma0 = diag(p) #Covariance matrices of the data
Sigma1 = diag(p)*2
# Generate data
for(t in 1:n){
  if(t < v[1] || t > v[2]){
     Y[,t] = MASS::mvrnorm(n = 1, mu0, Sigma0)
  }
  if(t >= v[1] && t < v[2]){
     Y[,t] = MASS::mvrnorm(n = 1, mu1, Sigma1)
  }
}## close for generate data
M = 10
intervals = WBS.intervals(M = M, lower = 1, upper = ncol(Y)) #Random intervals
K_max = 30
h = 5*(K_max*log(n)/n)^{1/p} # bandwith
temp = WBS.multi.nonpar(Y, Y, 1, ncol(Y), intervals$Alpha, intervals$Beta, h, delta = 10)
result = thresholdBS(temp, median(temp$Dval))

Run the code above in your browser using DataLab