Spec: Calculate change points with spectral cluster

Description Usage Arguments Details Value Author(s) Examples

View source: R/Spec.R

Description

Calculate change point based on spectral clustering you have the option to automatically calculate the number of clusters if this information is not available

Usage

1
2
Spec(data, neighboorsNumber = 5, tolerance = 0.01,
  maxNumberOfChangePoints = 19, estimationChangePointsNumber = NULL)

Arguments

data

List of values corresponding to the time series

neighboorsNumber

Number of neighbors to consider affinity between nodes

tolerance

approximation to consider valid clusters, used only for calculation of forecast of change points, default 0.01

maxNumberOfChangePoints

maximum number of clusters for prediction : default 19

estimationChangePointsNumber

predicted number of change points in the series, if null, is automatically calculated: default null

Details

Calculate change point based on spectral clustering you have the option to automatically calculate the number of clusters if this information is not available. It uses the Gaussian Kernel for the calculation of affinity matrix and Kmeans for the spectral cluster, however, several other options can be used and the package must be customized to better suit the use.

Value

Numerical array with the position of the change points in the time series

Author(s)

Luis Gustavo Uzai

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data <- DEVICE1[, 1]
realChangePoints <- c(which(diff(DEVICE1$Class) != 0)) 
calculateChangePoints <- Spec(data, neighboorsNumber = 6, 
         tolerance = 0.005, estimationChangePointsNumber = 2)
minValue <- -99999
maxValue <- 99999
plot(data, type = "l", xlab = "x", ylab = "y")
for (r in 1:length(realChangePoints)) {
    lines(x = c(realChangePoints[r], realChangePoints[r]), 
          y = c(minValue, maxValue), lwd = 2, col = "red")
}
for (n in 1:length(calculateChangePoints)) {
 lines(x = c(calculateChangePoints[n], calculateChangePoints[n]), 
       y = c(minValue, maxValue), lwd = 2, col = "blue")
}

SpecDetec documentation built on May 2, 2019, 1:08 p.m.

Related to Spec in SpecDetec...