plot.SNSeg_HD {SNSeg}R Documentation

Plotting the output for high-dimensional time series with dimension greater than 10

Description

Plotting method for S3 objects of class SNSeg_HD

Usage

## S3 method for class 'SNSeg_HD'
plot(x, cpts.col = "red", ts_index = c(1:5), ...)

Arguments

x

a SNSeg_HD object

cpts.col

a specification for the color of the vertical lines at the change point estimators, see par

ts_index

The index number(s) of the univariate time series to be plotted. Users should enter a positive integer or a vector of positive integers that are no greater than the dimension of the input time series. The default is the first 5 time series, i.e., ts_index = c(1:5).

...

additional graphical arguments, see plot and abline

Details

The location of each change point estimator is plotted as a vertical line against the input time series.

Examples


n <- 500
p <- 50
nocp <- 5
cp_sets <- round(seq(0,nocp+1,1)/(nocp+1)*n)
num_entry <- 5
kappa <- sqrt(4/5)
mean_shift <- rep(c(0,kappa),100)[1:(length(cp_sets)-1)]
set.seed(1)
ts <- matrix(rnorm(n*p,0,1),n,p)
no_seg <- length(cp_sets)-1
for(index in 1:no_seg){
  tau1 <- cp_sets[index]+1
  tau2 <- cp_sets[index+1]
  ts[tau1:tau2,1:num_entry] <- ts[tau1:tau2,1:num_entry] +
    mean_shift[index]
}

# grid_size defined
result <- SNSeg_HD(ts, confidence = 0.9, grid_size_scale  = 0.05,
                   grid_size = 40)
# plot the 1st, 3rd and 5th time series
plot(result, cpts.col = 'red', ts_index = c(1,3,5))



[Package SNSeg version 1.0.2 Index]