Descaler: Invert taking logs and differences of a time series

Description Usage Arguments Details Author(s) Examples

View source: R/Descaler.R

Description

For a series that has been logged and/or differenced, this function reverses these transformations.

Usage

1
Descaler(x, y = NA, Diff = 0, Sdiff = 0, Log = FALSE, Lag = NA)

Arguments

x

time series

y

time series used as benchmark

Diff

number of differences to be taken

Sdiff

number of seasonal differences to be taken

Log

Should time series be logarithmised

Lag

Lag for Sdiff can be specified

Details

The time series used as a benchmark (y) is necessary, if regular or seasonal differences have to be inversed, because the first values of this series are used to reconstruct the original values or benchmark the new series.

Author(s)

Daniel Ollech

Examples

1
2
3
a = ts(rnorm(100, 100, 10), start=c(2015,1), frequency=12)
b = Scaler(a, Diff=1, Log=TRUE)
Descaler(b,a, Diff=1, Log=TRUE)

Example output

           Jan       Feb       Mar       Apr       May       Jun       Jul
2015 109.71067  95.58019  94.96416  90.48250  85.43386  92.22449 113.98468
2016 116.58441 109.57948  93.15776  98.68766 103.13069  91.76699 100.02957
2017 110.92035 108.33363  95.42445 112.29368  95.48795  78.46491 114.17825
2018  93.26285 101.07129 119.90323 100.83908  62.21455 118.18521  95.04730
2019 100.30661 105.10854 100.80742  93.73664 101.17704  96.41889  95.59289
2020  92.01138  88.46009  93.23586  95.35473 101.98519  86.13128 100.68030
2021  97.46135 105.28630  88.88044  98.02632 110.11137  97.63707  86.15036
2022 109.24538  96.06781 117.47323  81.72192 101.76583  91.66555 112.92018
2023  93.28729 103.57812 100.61538  80.85379                              
           Aug       Sep       Oct       Nov       Dec
2015 113.84583  98.87462 104.54460 102.85462  75.97233
2016  96.11684 105.24261 106.07055  95.82248 109.35540
2017 104.58082 112.32896 108.72812 127.79378  83.74750
2018  98.15182 106.61430  98.70317  90.40965  90.39427
2019  93.03943 109.91761  85.27966 104.33460  93.41874
2020  92.90573 105.69532  96.96152  93.94454 113.87850
2021  84.30214  92.32607 105.98253  96.58511 105.95364
2022  73.34936  93.04150 104.70455 101.93279 104.96665
2023                                                  

dsa documentation built on June 21, 2021, 9:07 a.m.