1
$\begingroup$

I have problem to make proper inverse transformation of a seasonally differenced forecast.

For example, I have the time series with the two periods period = c(19, 532) like this:

set.seed(123)
per <- 19
x_ts <- rep(sin(seq(0, (2*pi), by = pi/9)), 84) + 200
x_ts[101:290] <- x_ts[101:290] + rep(seq(1, 20, by = 2), each = per)
x_ts[291:480] <- x_ts[291:480] + 20 - rep(seq(1, 20, by = 2), each = per)
x_ts[601:790] <- x_ts[601:790] + rep(seq(1, 23, by = 2.3), each = per)
x_ts[791:980] <- x_ts[791:980] + 23 - rep(seq(1, 23, by = 2.3), each = per)
x_ts[1101:1290] <- x_ts[1101:1290] + rep(seq(1, 19, by = 1.9), each = per)
x_ts[1291:1480] <- x_ts[1291:1480] + 19 - rep(seq(1, 19, by = 1.9), each = per)
x_ts <- x_ts + rnorm(length(x_ts), sd = 0.7)
plot(ts(x_ts))

enter image description here

This time series is obviously non-stationary (we need to do 2-times differentiation): ndiffs(diff(x_ts, lag = per)) [1] 1

Now, I want to make a forecast of length 532 (the larger period). I will do it by exponential smoothing from smooth package:

library(smooth)
es_x <- es(ts(diff(x_ts, lag = per, differences = 2), freq = 532), model = "ANA", h = 532, silent = "none")

enter image description here

The forecast seems all right, isn't it?

But, when I want to make inverse transformation of the whole long forecast, something goes bad...

for_inv <- diffinv(es_x$forecast, lag = per, differences = 2, xi = tail(x_ts, per*2))
plot(ts(for_inv[-c(1:(per*2))]))

enter image description here

I am using the last two periods of original time series as initial values to inverse seasonal differentiation of level two.

Please, what is wrong with my approach? I don't want to use ARIMA or other typical time series forecasting method, but some advanced regression methods like boosting. Differentiating the time series make sense with these methods. I read questions about inverse transformation of differenced ts, but no one issued long forecasts of seasonally differenced ts.

$\endgroup$
0
$\begingroup$

I'm not sure why you would need seasonal differences here, as the seasonality seems to be well behaved (at least the original graph has a quite stable seasonal amplitude). I would expect the need to do that if the seasonality of the original data had multiplicative characteristics. That would be a legit SARIMA approach to the problem. But exponential smoothing is usually applied to non-differenced data, because the ETS model itself handles the non-stationarity (either normal or seasonal) on its own. For example, ETS(MMM) would handle the exponential trend with multiplicative seasonality. So maybe fit the model without differences and see whether it works?

And as a clarification, what you observe as a forecast after the inverse transformation of differences, is exactly the series, for which you would need to take differences: with increasing trend and amplitude.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.