WBS.network {changepoints}R Documentation

Wild binary segmentation for network change points detection.

Description

Perform wild binary segmentation for network change points detection.

Usage

WBS.network(data_mat1, data_mat2, s, e, Alpha, Beta, delta, level = 0)

Arguments

data_mat1

A numeric matrix of observations with with horizontal axis being time, and with each column be the vectorized adjacency matrix.

data_mat2

An independent copy of data_mat1.

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.

delta

A positive integer scalar of minimum spacing.

level

Should be fixed as 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.

Author(s)

Daren Wang & Haotian Xu

References

Wang, Yu and Rinaldo (2018) <arxiv:1809.09602>.

See Also

thresholdBS for obtaining change points estimation.

Examples

p = 15 # number of nodes
rho = 0.5 # sparsity parameter
block_num = 3 # number of groups for SBM
n = 100 # sample size for each segment
# connectivity matrix for the first and the third segments
conn1_mat = rho * matrix(c(0.6,1,0.6,1,0.6,0.5,0.6,0.5,0.6), nrow = 3) 
# connectivity matrix for the second segment
conn2_mat = rho * matrix(c(0.6,0.5,0.6,0.5,0.6,1,0.6,1,0.6), nrow = 3) 
set.seed(1)
can_vec = sample(1:p, replace = FALSE) # randomly assign nodes into groups
sbm1 = simu.SBM(conn1_mat, can_vec, n, symm = TRUE, self = TRUE)
sbm2 = simu.SBM(conn2_mat, can_vec, n, symm = TRUE, self = TRUE)
data_mat = cbind(sbm1$obs_mat, sbm2$obs_mat)
data_mat1 = data_mat[,seq(1,ncol(data_mat),2)]
data_mat2 = data_mat[,seq(2,ncol(data_mat),2)]
M = 10
intervals = WBS.intervals(M = M, lower = 1, upper = ncol(data_mat1))
temp = WBS.network(data_mat1, data_mat2, 1, ncol(data_mat1), 
                   intervals$Alpha, intervals$Beta, delta = 5)
rho_hat = quantile(rowMeans(data_mat), 0.95)
tau = p*rho_hat*(log(n))^2/20 # default threshold given in the paper
cpt_init = unlist(thresholdBS(temp, tau)$cpt_hat[,1])
cpt_refined = local.refine.network(cpt_init, data_mat1, data_mat2, 
                      self = TRUE, tau2 = p*rho_hat/3, tau3 = Inf)
cpt_WBS = 2*cpt_init
cpt_refined = 2*cpt_refined

[Package changepoints version 1.1.0 Index]