Description
The Burst function bursts (splits) a time interval into a series of
shorter "burst" intervals and allocates values from the time intervals
into the new, shorter subintervals. The Burst function is useful for
allocating values from overlapping time intervals into user-defined time
intervals (for example, when a cable company has customer data from
overlapping time intervals, which it wants to analyze by dividing into
uniform time intervals). The Burst function supports several allocation
methods.
The burst intervals can have either the same length (specified by the
"time.interval" argument), the same number of data points (specified
by the "num.points" argument), or specific start and end
times (specified by "time.data").
Usage
td_burst_mle (
data = NULL,
time.data = NULL,
time.column = NULL,
value.columns = NULL,
time.interval = NULL,
time.datatype = NULL,
value.datatype = NULL,
start.time = NULL,
end.time = NULL,
num.points = NULL,
values.before.first = NULL,
values.after.last = NULL,
split.criteria = "nosplit",
seed = NULL,
accumulate = NULL,
data.sequence.column = NULL,
time.data.sequence.column = NULL,
data.partition.column = NULL,
time.data.partition.column = NULL,
data.order.column = NULL,
time.data.order.column = NULL
)
Arguments
data |
Required Argument. |
data.partition.column |
Required Argument. |
data.order.column |
Optional Argument. |
time.data |
Optional Argument. |
time.data.partition.column |
Optional Argument. Required if "time.data" is specified. |
time.data.order.column |
Optional Argument. |
time.column |
Required Argument. |
value.columns |
Required Argument. |
time.interval |
Optional Argument. |
time.datatype |
Optional Argument. |
value.datatype |
Optional Argument. |
start.time |
Optional Argument. |
end.time |
Optional Argument. |
num.points |
Optional Argument. |
values.before.first |
Optional Argument. |
values.after.last |
Optional Argument. |
split.criteria |
Optional Argument. |
seed |
Optional Argument. |
accumulate |
Optional Argument. |
data.sequence.column |
Optional Argument. |
time.data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_burst_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("burst_example", "burst_data", "finance_data", "time_table2")
# Create object(s) of class "tbl_teradata".
burst_data <- tbl(con, "burst_data")
finance_data <- tbl(con, "finance_data")
time_table2 <- tbl(con, "time_table2")
# Example 1: Use "time.interval" argument to burst the data for
# a duration of 1 day (86400 seconds).
td_burst_out1 <- td_burst_mle(data = burst_data,
data.partition.column = c("id"),
data.order.column = "id",
time.column = c("start_time_column", "end_time_column"),
value.columns = c("num_custs"),
time.interval = 86400,
start.time = "08/01/2010",
end.time = "08/10/2010",
split.criteria = "nosplit",
accumulate = c("id")
)
# Example 2: "split.criteria" = proportional.
td_burst_out2 <- td_burst_mle(data = burst_data,
data.partition.column = c("id"),
data.order.column = "id",
time.column = c("start_time_column", "end_time_column"),
value.columns = c("num_custs"),
time.interval = 86400,
start.time = "08/01/2010",
end.time = "08/10/2010",
split.criteria = "proportional",
accumulate = c("id")
)
# Example 3: "split.criteria" = gaussian.
td_burst_out3 <- td_burst_mle(data = burst_data,
data.partition.column = c("id"),
data.order.column = "id",
time.column = c("start_time_column", "end_time_column"),
value.columns = c("num_custs"),
time.interval = 86400,
start.time = "08/01/2010",
end.time = "08/10/2010",
split.criteria = "gaussian",
accumulate = c("id")
)
# Example 4: uses a "time.data" argument, "values.before.first" and "values.after.last".
# The "time.data" option allows the use of different time intervals and partitions the
# data accordingly.
td_burst_out4 <- td_burst_mle(data = finance_data,
data.partition.column = c("id"),
data.order.column = "id",
time.data = time_table2,
time.data.partition.column = c("id"),
time.data.order.column = "burst_start",
time.column = c("start_time_column", "end_time_column"),
value.columns = c("expenditure", "income", "investment"),
start.time = "06/30/1967",
end.time = "07/10/1967",
values.before.first = c("NULL","NULL","NULL"),
values.after.last = c("NULL","NULL","NULL"),
accumulate = c("id")
)