Forecasting in R
Rob J. Hyndman
Professor of Statistics at Monash University
If the data show increasing variation as the level of the series increases, then a transformation can be useful
$y_1,...,y_n$: original observations, $w_1,...,w_n$: transformed observations
Square root | $w_t = \sqrt{y_t}$ | $\downarrow$ |
Cube root | $w_t = \sqrt[3]{y_t}$ | Increasing |
Logarithm | $w_t = \text{log}(y_t)$ | Strength |
Inverse | $w_t = -1/y_t$ | $\downarrow$ |
autoplot(usmelec) +
xlab("Year") + ylab("") +
ggtitle("US monthly net electricity generation")
autoplot(usmelec^0.5) +
xlab("Year") + ylab("") +
ggtitle("Square root electricity generation")
autoplot(usmelec^0.33333) +
xlab("Year") + ylab("") +
ggtitle("Cube root electricity generation")
autoplot(log(usmelec)) +
xlab("Year") + ylab("") +
ggtitle("Log electricity generation")
autoplot(-1/usmelec) +
xlab("Year") + ylab("") +
ggtitle("Inverse electricity generation")
$$w_t = \begin{cases} log(y_t) & \lambda = 0 \\ (y_t^\lambda - 1)/\lambda & \lambda \neq 0 \end{cases}$$
BoxCox.lambda(usmelec)
-0.5738331
usmelec %>%
ets(lambda = -0.57) %>%
forecast(h = 60) %>%
autoplot()
Forecasting in R