| log_interval_vec {timetk} | R Documentation |
The log_interval_vec() transformation constrains a forecast to an interval
specified by an upper_limit and a lower_limit.
log_interval_vec( x, limit_lower = "auto", limit_upper = "auto", offset = 0, silent = FALSE ) log_interval_inv_vec(x, limit_lower, limit_upper, offset = 0)
x |
A positive numeric vector. |
limit_lower |
A lower limit. Must be less than the minimum value. If set to "auto", selects a value that is 10% greater than the maximum value. |
limit_upper |
An upper limit. Must be greater than the maximum value. If set to "auto", selects zero. |
offset |
An offset to include in the log transformation. Useful when the data contains values less than or equal to zero. |
silent |
Whether or not to report the parameter selections as a message. |
Log Interval Transformation
The Log Interval Transformation constrains values to specified upper and lower limits. The transformation maps limits to a function:
log(((x + offset) - a)/(b - (x + offset)))
where a is the lower limit and b is the upper limit
Inverse Transformation
The inverse transformation:
(b-a)*(exp(x)) / (1 + exp(x)) + a - offset
Box Cox Transformation: box_cox_vec()
Lag Transformation: lag_vec()
Differencing Transformation: diff_vec()
Rolling Window Transformation: slidify_vec()
Loess Smoothing Transformation: smooth_vec()
Fourier Series: fourier_vec()
Missing Value Imputation for Time Series: ts_impute_vec(), ts_clean_vec()
Other common transformations to reduce variance: log(), log1p() and sqrt()
library(dplyr) library(timetk) d10_daily <- m4_daily %>% filter(id == "D10") # --- VECTOR ---- value_interval <- log_interval_vec(d10_daily$value, limit_lower = 0, limit_upper = 2700) value <- log_interval_inv_vec(value_interval, limit_lower = 0, limit_upper = 2700)