Learn R Programming

fable (version 0.0.0.9000)

new_transformation: Create a new modelling transformation

Description

Produces a new transformation for fable modelling functions which will be used to transform, back-transform, and adjust forecasts.

Usage

new_transformation(transformation, inverse)

Arguments

transformation

A function which transforms the data

inverse

A function which is the inverse of a transformation

Details

For more details about transformations, read the vignette: vignette("transformations", package = "fable")

Examples

Run this code
# NOT RUN {
scaled_logit <- function(x, lower=0, upper=1){
  log((x-lower)/(upper-x))
}
inv_scaled_logit <- function(x, lower=0, upper=1){
  (upper-lower)*exp(x)/(1+exp(x)) + lower
}
my_scaled_logit <- new_transformation(scaled_logit, inv_scaled_logit)

t_vals <- my_scaled_logit(1:10, 0, 100)
t_vals
invert_transformation(my_scaled_logit)(t_vals, 0, 100)

# }

Run the code above in your browser using DataLab