Description
The ChangePointDetection function detects change points in a stochastic process or time series, using retrospective change-point detection, implemented with these algorithms:
Search algorithm: binary search
Segmentation algorithm: normal distribution and linear regression
The function takes sorted time series data as input and generates change points or data segments as output.
Usage
td_changepoint_detection_mle (
data = NULL,
data.partition.column = NULL,
data.order.column = NULL,
value.column = NULL,
accumulate = NULL,
segmentation.method = "normal_distribution",
search.method = "binary",
max.change.num = 10,
penalty = "BIC",
output.option = "changepoint",
data.sequence.column = NULL
)
Arguments
data |
Required Argument. |
data.partition.column |
Required Argument. |
data.order.column |
Required Argument. |
value.column |
Required Argument. |
accumulate |
Required Argument. |
segmentation.method |
Optional Argument.
|
search.method |
Optional Argument. |
max.change.num |
Optional Argument. |
penalty |
Optional Argument.
|
output.option |
Optional Argument. |
data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_changepoint_detection_mle"
which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator
using the name: result.
Examples
# Get the current context/connection
con <- td_get_context()$connection
# Load example data.
loadExampleData("changepointdetection_example", "finance_data2" , "cpt")
# Create object(s) of class "tbl_teradata".
# The input signal is like a clock signal whose values can represent a
# cyclic recurrence of an event (for example, electric power consumption at
# certain periods or sequence, pulserate, and so on).
cpt <- tbl(con,"cpt")
# Input contains two time series of finance data.
finance_data2 <- tbl(con,"finance_data2")
# Example 1: Two Series, Default Options.
td_changepoint_detection_out1 <- td_changepoint_detection_mle(data=finance_data2,
data.partition.column='sid',
data.order.column='id',
value.column='expenditure',
accumulate=c('sid','id','expenditure'))
# Example 2 - One Series, Default Options.
td_changepoint_detection_out2 <- td_changepoint_detection_mle(data=cpt,
data.partition.column="sid",
data.order.column="id",
value.column = "val",
accumulate = c("sid", "id")
)
# Example 3 - One Series, VERBOSE Output.
td_changepoint_detection_out3 <- td_changepoint_detection_mle(data=cpt,
value.column = "val",
data.partition.column="sid",
data.order.column="id",
accumulate = c("sid","id"),
output.option = "verbose"
)
# Example 4 - One Series, Penalty 10.
td_changepoint_detection_out4 <- td_changepoint_detection_mle(data=cpt,
data.partition.column="sid",
data.order.column="id",
value.column = "val",
accumulate = c("sid","id"),
penalty = "10"
)
# Example 5 - One Series, SEGMENT Output, Penalty 10.
td_changepoint_detection_out5 <- td_changepoint_detection_mle(data=cpt,
data.partition.column="sid",
data.order.column="id",
value.column = "val",
accumulate = c("sid","id"),
penalty = "10",
output.option = "segment"
)
# Example 6 - One Series, Penalty 20, Linear Regression.
td_changepoint_detection_out6 <- td_changepoint_detection_mle(data=cpt,
data.partition.column="sid",
data.order.column="id",
value.column = "val",
accumulate = c("sid","id"),
segmentation.method = "linear_regression",
penalty = "20"
)