Skip to contents

step_weibull_adstock() creates a specification of a recipe step that will adstock transform data.

Usage

step_weibull_adstock(
  recipe,
  ...,
  role = "predictor",
  trained = FALSE,
  shape = 1,
  scale = 1,
  max_carryover = 12,
  normalize = TRUE,
  columns = NULL,
  skip = FALSE,
  id = recipes::rand_id("weibull_adstock")
)

Arguments

recipe

A recipe object. The step will be added to the sequence of operations for this recipe.

...

One or more selector functions to choose variables for this step. See selections() for more details.

role

For model terms created by this step, what analysis role should they be assigned? By default, the new columns created by this step from the original variables will be used as predictors in a model.

trained

A logical to indicate if the quantities for preprocessing have been estimated.

shape

Shape parameter

scale

Scale parameter

max_carryover

Maximum Carryover parameter for the weibull adstock transformation

normalize

Should adstock weights be normalized to sum up to 1

columns

A character string of the selected variable names. This field is a placeholder and will be populated once prep() is used.

skip

A logical. Should the step be skipped when the recipe is baked by bake()? While all operations are baked when prep() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = TRUE as it may affect the computations for subsequent operations.

id

A character string that is unique to this step to identify it

Value

An updated version of recipe with the new step added to the sequence of any existing operations.

Examples

library(tidymodels)
#> Error in library(tidymodels): there is no package called ‘tidymodels’
library(tidymmm)
data(mmm_imps)
mmm_recipe <-
  recipe(kpi_sales ~ mi_tv, data = mmm_imps) |>
  step_weibull_adstock(mi_tv)
#> Error in recipe(kpi_sales ~ mi_tv, data = mmm_imps): could not find function "recipe"