Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

new_modeltime_bridge

Constructor for creating modeltime models


Description

These functions are used to construct new modeltime bridge functions that connect the tidymodels infrastructure to time-series models containing date or date-time features.

Usage

new_modeltime_bridge(class, models, data, extras = NULL, desc = NULL)

Arguments

class

A class name that is used for creating custom printing messages

models

A list containing one or more models

data

A data frame (or tibble) containing 4 columns: (date column with name that matches input data), .actual, .fitted, and .residuals.

extras

An optional list that is typically used for transferring preprocessing recipes to the predict method.

desc

An optional model description to appear when printing your modeltime objects

Examples

library(stats)
library(tidyverse)
library(lubridate)
library(timetk)

lm_model <- lm(value ~ as.numeric(date) + hour(date) + wday(date, label = TRUE),
               data = taylor_30_min)

data = tibble(
    date        = taylor_30_min$date, # Important - The column name must match the modeled data
    # These are standardized names: .actual, .fitted, .residuals
    .actual     = taylor_30_min$value,
    .fitted     = lm_model$fitted.values %>% as.numeric(),
    .residuals  = lm_model$residuals %>% as.numeric()
)

new_modeltime_bridge(
    class  = "lm_time_series_impl",
    models = list(model_1 = lm_model),
    data   = data,
    extras = NULL
)

modeltime

The Tidymodels Extension for Time Series Modeling

v0.5.1
MIT + file LICENSE
Authors
Matt Dancho [aut, cre], Business Science [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.