expm1_decomposed() converts the output of time_decompose() back to the linear scale when the input to time_decompose() is on the log scale. This amounts to selective sequential application of expm1() to the component columns.

expm1_decomposed(.data)

Arguments

.data

The output of time_decompose()

Value

The input decomposition with expm1() applied appropriately

Details

Because log-scale additive decomposition is multiplicative decomposition on the linear scale, functions which automatically perform decomposition on the log scale yield unexpected output. To remedy this, an approximate conversion back to the linear scale can be performed. The steps are as follows (with all exponentiation follow by an "add-1" operation):

  1. observed: Exponentiate the observed column

  2. trend: Exponentiate the trend column

  3. season: Exponentiate trend + season and subtract the exponentiated trend

  4. remainder Subtract the exponentiated trend and season from the exponentiated observed values (observed - trend - season)

The underlying code is perhaps a simpler explanation than the above; consult it for further exposition.

Exponentiating the observed values is a simple inverse transform; however, the component columns require some assumptions to convert back to a linear scale. This process uses the trend as a "base" and simply exponentiates it as in observed. This can then be used to derive the season component, and the remainder is whatever is left over. While this is not a theoretically valid process (there is none for this operation), it is consistent with treating the trend as a smoothed version of observed, which is usually done in practice. Once this assumption is made, the season transformation becomes valid. The remainder is then assumed to be the difference between the observed values (observed) expected values (season + trend), as usual.

See also