Description
The CCM function takes two or more time series as input and evaluates potential cause-effect relationships between them. Each time series column can be a single, long time series or a set of shorter subsequences that represent the same process. The function returns an effect size for each cause-effect pair.
Usage
td_ccm_mle (
data = NULL,
sequence.id.column = NULL,
time.column = NULL,
cause.columns = NULL,
effect.columns = NULL,
library.size = 100,
embedding.dimension = 2,
time.step = 1,
bootstrap.iterations = 100,
predict.step = 1,
self.predict = FALSE,
seed = NULL,
point.select.rule = "DistanceOnly",
mode = "Single",
data.sequence.column = NULL
)
Arguments
data |
Required Argument. |
sequence.id.column |
Required Argument. |
time.column |
Required Argument. |
cause.columns |
Required Argument. |
effect.columns |
Required Argument. |
library.size |
Optional Argument. |
embedding.dimension |
Optional Argument. |
time.step |
Optional Argument. |
bootstrap.iterations |
Optional Argument. |
predict.step |
Optional Argument. |
self.predict |
Optional Argument. |
seed |
Optional Argument. |
point.select.rule |
Optional Argument. |
mode |
Optional Argument. |
data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_ccm_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("ccmprepare_example", "ccmprepare_input")
loadExampleData("ccm_example", "ccm_input", "ccm_input2")
# Load the time series datasets.
ccm_input <- tbl(con, "ccm_input")
ccm_input2 <- tbl(con, "ccm_input2")
ccmprepare_input <- tbl(con, "ccmprepare_input")
# Example 1: Find causal-effect relationship between income, expenditure and
# investiment fields.
td_ccm_out <- td_ccm_mle(data = ccm_input,
sequence.id.column = "id",
time.column = "period",
cause.columns = c("income"),
effect.columns = c("expenditure","investment"),
seed = 0
)
# Example 2: Alternatively, the below example produces the same output as above
# by making use of td_ccm_prepare_mle() and then using its output as input
# for td_ccm_mle().
td_ccm_prepare_out <- td_ccm_prepare_mle(data = ccmprepare_input,
data.partition.column = "id"
)
td_ccm_out1 <- td_ccm_mle(data = td_ccm_prepare_out$result,
sequence.id.column = "id",
time.column = "period",
cause.columns = c("income"),
effect.columns = c("expenditure","investment"),
seed = 0
)
# Example 3: Find the cause-effect relation on a sample market time series data.
td_ccm_out2 <- td_ccm_mle(data = ccm_input2,
sequence.id.column = "id",
time.column = "period",
cause.columns = c("marketindex","indexval"),
effect.columns = c("indexdate","indexchange"),
library.size = 10,
seed = 0
)