Learn R Programming

tidysynthesis (version 0.1.2)

invert.step_BoxCox: Invert a Box-Cox transformation

Description

Invert a Box-Cox transformation

Usage

# S3 method for step_BoxCox
invert(object, predictions, ...)

Value

A tibble with the Box-Cox transformation inverted for .pred

Arguments

object

A recipe after fitting a model

predictions

A data frame with .pred

...

Other arguments

Examples

Run this code

data <- tibble::tibble(
  y = rlnorm(n = 1000, meanlog = 0, sdlog = 1),
  x = rnorm(n = 1000)
)

adj <- recipes::recipe(y ~ x, data = data) |>
  recipes::step_BoxCox(recipes::all_outcomes()) |>
  recipes::prep()
  
invert(
  object = adj$steps[[1]], 
  predictions = tibble::tibble(.pred = adj[["template"]][["y"]])
)

Run the code above in your browser using DataLab