split_data_counterfactual | R Documentation |
Splits prepared data into training and application datasets based on
specified date ranges for a business-as-usual scenario. Data before
application_start
and after application_end
is used as training data,
while data within the date range is used for application.
split_data_counterfactual(dt_prepared, application_start, application_end)
dt_prepared |
The prepared data table. |
application_start |
The start date(date object) for the application period of the business-as-usual simulation. This coincides with the start of the reference window. Can be created by e.g. lubridate::ymd("20191201") |
application_end |
The end date(date object) for the application period of the business-as-usual simulation. This coincides with the end of the effect window. Can be created by e.g. lubridate::ymd("20191201") |
A list with two elements:
Data outside the application period.
Data within the application period.
dt_prepared <- data.table::data.table(
date = as.Date(c("2023-01-01", "2023-01-05", "2023-01-10")),
value = c(50, 60, 70)
)
result <- split_data_counterfactual(
dt_prepared,
application_start = as.Date("2023-01-03"),
application_end = as.Date("2023-01-08")
)
print(result$train)
print(result$apply)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.