I am doing time series forecasting and running Holts Method
with several variations.(exponential, damped, simple)
> dput(tsOenb)
structure(c(142.8163942, 143.5711365, 145.3485827, 142.0577145,
139.4326176, 140.1236581, 138.6560282, 136.405036, 133.9337229,
133.8785538, 132.0608441, 130.0866307, 120.1320237, 119.6368882,
114.3312943, 117.5084111, 114.4960017, 112.9124518, 112.8185478,
112.3047916, 106.632639, 106.2107158, 106.8455028, 106.3879556,
104.3451786, 102.9085952, 101.0967783, 101.7858278, 101.0749044,
102.6441976, 102.0666152, 100, 97.14084104, 97.49972913, 96.91453836,
96.05132443, 94.98057971, 92.78373451, 92.67526281, 91.82430571,
91.4153859, 89.51740671, 89.01587176, 84.62259911, 91.48598494,
89.12053042, 90.02364352, 90.92496121, 89.42963565, 91.93886583,
88.83918306, 90.39513509, 87.54571761, 91.3386451, 87.7836994,
91.79178376, 87.56903138, 87.77875755, 89.29938784), .Tsp = c(2000.25,
2014.75, 4), class = "ts")
>
> fit1 <- ses(tsOenb)
> fit2 <- holt(tsOenb)
> fit3 <- holt(tsOenb,exponential=TRUE)
> fit4 <- holt(tsOenb,damped=TRUE)
> fit5 <- holt(tsOenb,exponential=TRUE,damped=TRUE)
> # Results for first model:
> fit1$model
ETS(A,N,N)
Call:
ses(x = tsOenb)
Smoothing parameters:
alpha = 0.8877
Initial states:
l = 142.9174
sigma: 2.6638
AIC AICc BIC
360.1846 360.3989 364.3397
> accuracy(fit1) # training set
ME RMSE MAE MPE MAPE MASE ACF1
Training set -1.026978 2.663777 1.9862 -0.937466 1.916168 0.4448575 -0.2346051
> accuracy(fit1,tsOenb) # test set
Error in window.default(x, ...) : 'start' cannot be after 'end'
In addition: Warning message:
In window.default(x, ...) : 'start' value not changed
>
> plot(fit2$model$state)
> plot(fit4$model$state)
>
> plot(fit3, type="o", ylab="Rental Price Index(hundreds)",
+ flwd=1, plot.conf=FALSE)
> lines(window(tsOenb,start=2000),type="o")
Warning message:
In window.default(x, ...) : 'start' Wert nicht geändert
> lines(fit1$mean,col=2)
> lines(fit2$mean,col=3)
> lines(fit4$mean,col=5)
> lines(fit5$mean,col=6)
> legend("topright", lty=1, pch=1, col=1:6,
+ c("Data","SES","Holt's","Exponential",
+ "Additive Damped","Multiplicative Damped"))
>
As you can see I get a forecast using this data set.
However, the time series is stationary and changing the time series to non stationary gives me errors.
> dput(tsOenb)
structure(c(1.0227039, -5.0683144, 0.6657713, 3.3161374, -2.1586704,
-0.7833623, -0.2203209, 2.416144, -1.7625406, -0.1565037, -7.9803936,
9.4594715, -4.8104584, 8.4827107, -6.1895262, 1.4288595, 1.4896459,
-0.4198522, -5.1583964, 5.2502294, 1.0567102, -1.0923342, -1.5852298,
0.6061936, -0.3752335, 2.5008664, -1.3999729, 2.2802166, -2.1468756,
-1.4890328, -0.79254376, 3.21804705, -0.94407886, -0.27802316,
-0.20753079, -1.12610048, 2.0883735, -0.7424854, 0.44203729,
-1.48905938, 1.39644424, -3.8917377, 11.25665848, -9.22884035,
3.26856762, -0.00179541, -2.39664325, 4.00455574, -5.60891295,
4.6556348, -4.40536951, 6.64234497, -7.34787319, 7.56303006,
-8.23083674, 4.43247855, 1.31090412, 1.0227039, -5.0683144), .Tsp = c(2000.25,
2014.75, 4), class = "ts")
>
> fit1 <- ses(tsOenb)
> fit2 <- holt(tsOenb)
> fit3 <- holt(tsOenb,exponential=TRUE)
Error in ets(x, "MMN", alpha = alpha, beta = beta, damped = damped, opt.crit = "mse") :
Inappropriate model for data with negative or zero values
> fit4 <- holt(tsOenb,damped=TRUE)
> fit5 <- holt(tsOenb,exponential=TRUE,damped=TRUE)
Error in ets(x, "MMN", alpha = alpha, beta = beta, damped = damped, opt.crit = "mse") :
Inappropriate model for data with negative or zero values
> # Results for first model:
> fit1$model
ETS(A,N,N)
Call:
ses(x = tsOenb)
Smoothing parameters:
alpha = 1e-04
Initial states:
l = -0.0558
sigma: 4.2163
AIC AICc BIC
414.3730 414.5873 418.5281
> accuracy(fit1) # training set
ME RMSE MAE MPE MAPE MASE ACF1
Training set 0.0001774118 4.216345 3.145087 45.47386 146.8709 0.8467864 -0.7332704
> accuracy(fit1,tsOenb) # test set
Error in window.default(x, ...) : 'start' cannot be after 'end'
In addition: Warning message:
In window.default(x, ...) : 'start' value not changed
>
> plot(fit2$model$state)
> plot(fit4$model$state)
>
> plot(fit3, type="o", ylab="Rental Price Index(hundreds)",
+ flwd=1, plot.conf=FALSE)
> lines(window(tsOenb,start=2000),type="o")
Warning message:
In window.default(x, ...) : 'start' Wert nicht geändert
> lines(fit1$mean,col=2)
> lines(fit2$mean,col=3)
> lines(fit4$mean,col=5)
> lines(fit5$mean,col=6)
> legend("topright", lty=1, pch=1, col=1:6,
+ c("Data","SES","Holt's","Exponential",
+ "Additive Damped","Multiplicative Damped"))
Hence, is it non-mandatory to clean a data set for stationary using exponential smoothing methods? Why? What are the advantages/disadvantages of using non-stationary data in time series analysis?
I appreciate your replies!