ts_auto_lm: Boilerplate Workflow

View source: R/boilerplate-lm.R

ts_auto_lmR Documentation

Boilerplate Workflow

Description

This is a boilerplate function to create automatically the following:

  • recipe

  • model specification

  • workflow

  • calibration tibble and plot

Usage

ts_auto_lm(
  .data,
  .date_col,
  .value_col,
  .formula,
  .rsamp_obj,
  .prefix = "ts_lm",
  .bootstrap_final = FALSE
)

Arguments

.data

The data being passed to the function. The time-series object.

.date_col

The column that holds the datetime.

.value_col

The column that has the value

.formula

The formula that is passed to the recipe like value ~ .

.rsamp_obj

The rsample splits object

.prefix

Default is ts_lm

.bootstrap_final

Not yet implemented.

Details

This uses parsnip::linear_reg() and sets the engine to lm

Value

A list

Author(s)

Steven P. Sanderson II, MPH

See Also

https://parsnip.tidymodels.org/reference/linear_reg.html

Other Boiler_Plate: ts_auto_arima_xgboost(), ts_auto_arima(), ts_auto_croston(), ts_auto_exp_smoothing(), ts_auto_glmnet(), ts_auto_mars(), ts_auto_nnetar(), ts_auto_prophet_boost(), ts_auto_prophet_reg(), ts_auto_smooth_es(), ts_auto_svm_poly(), ts_auto_svm_rbf(), ts_auto_theta(), ts_auto_xgboost()

Examples


library(dplyr)
library(timetk)
library(modeltime)

data <- AirPassengers %>%
  ts_to_tbl() %>%
  select(-index)

splits <- time_series_split(
  data
  , date_col
  , assess = 12
  , skip = 3
  , cumulative = TRUE
)

ts_lm <- ts_auto_lm(
  .data = data,
  .date_col = date_col,
  .value_col = value,
  .rsamp_obj = splits,
  .formula = value ~ .,
)

ts_lm$recipe_info



healthyR.ts documentation built on Nov. 15, 2023, 9:07 a.m.