tbss: block segmentation scheme (BSS).

View source: R/Functions_BSS_SGL.R

tbssR Documentation

block segmentation scheme (BSS).

Description

Perform the block segmentation scheme (BSS) algorithm to detect the structural breaks in large scale high-dimensional non-stationary VAR models.

Usage

tbss(
  data,
  method = c("sparse", "group sparse", "fLS"),
  group.case = c("columnwise", "rowwise"),
  group.index = NULL,
  lambda.1.cv = NULL,
  lambda.2.cv = NULL,
  mu = NULL,
  q = 1,
  max.iteration = 50,
  tol = 10^(-2),
  block.size = NULL,
  blocks = NULL,
  refit = FALSE,
  use.BIC = TRUE,
  an.grid = NULL
)

Arguments

data

input data matrix, with each column representing the time series component

method

method: sparse, group sparse, and fixed low rank plus sparse. Default is sparse

group.case

group sparse pattern: column, row.

group.index

group index for group sparse case

lambda.1.cv

tuning parameter lambda_1 for fused lasso

lambda.2.cv

tuning parameter lambda_2 for fused lasso

mu

tuning parameter for low rank component, only available when method is set to "fLS"

q

the AR order

max.iteration

max number of iteration for the fused lasso

tol

tolerance for the fused lasso

block.size

the block size

blocks

the blocks

refit

logical; if TRUE, refit the VAR model for parameter estimation. Default is FALSE.

use.BIC

use BIC for k-means part

an.grid

a vector of an for grid searching

Value

S3 object of class VARDetect.result, which contains the followings

data

the original dataset

q

the time lag user specified, a numeric value

cp

final estimated change points, a numeric vector

sparse_mats

estimated sparse components for each segment, a list of numeric matrices

lowrank_mats

estimated low rank components for each segment, a list of numeric matrices

est_phi

estimated final model parameters, the summation of the sparse and the low rank components

time

computation time for each step

Examples

#### sparse VAR model
nob <- (10^3); #number of time points
p <- 15; # number of time series components
brk <- c(floor(nob/3),floor(2*nob/3),nob+1); # true break points with nob+1 as the last element
m0 <- length(brk) -1; # number of break points
q.t <- 1; # the true AR order
m <- m0+1 #number of segments
try<-simu_var('sparse',nob=nob,k=p,lags=q.t,brk = brk,sp_pattern="off-diagonal",seed=1)
data <- try$series
data <- as.matrix(data)
#run the bss method
fit <- tbss(data, method = "sparse", q = q.t)
print(fit)
summary(fit)
plot(fit, data, display = "cp")
plot(fit, data, display = "param")


###### Example for fixed low rank plus sparse structure VAR model
nob <- 300
p <- 15
brk <- c(floor(nob/3), floor(2*nob/3), nob+1)
m <- length(brk)
q.t <- 1
signals <- c(-0.7, 0.7, -0.7)
rank <- c(2, 2, 2)
singular_vals <- c(1, 0.75)
info_ratio <- rep(0.35, 3)
try <- simu_var(method = "fLS", nob = nob, k = p, lags = 1, brk = brk, 
                sigma = as.matrix(diag(p)), signals = signals, seed=1, 
                rank = rank, singular_vals = singular_vals, info_ratio = info_ratio, 
                sp_pattern = "off-diagonal", spectral_radius = 0.9)
data <- try$series
data <- as.matrix(data)
fit <- tbss(data, method = "fLS", mu = 150)
print(fit)
summary(fit)
plot(fit, data, display = "cp")
plot(fit, data, display = "param")

VARDetect documentation built on May 10, 2022, 9:07 a.m.

Related to tbss in VARDetect...