refer to the link: How to choose a forecast for your time series – Nikolaos Kourentzes
How should i add fitting and validation area in the plot, according to the Fig. 2: ETS and ARIMA forecasts on validation set. The models are fitted only in the first part of the time series and the validation set is used only to assess their performance.
my dataset ( zz
) as below:
X dataid meter_value
2015-10-27 19:50:00 1103 183138
2015-10-27 19:51:00 1103 183138
2015-10-27 19:52:00 1103 183138
2015-10-27 19:53:00 1103 183138
2015-10-27 19:54:00 1103 183138
2015-10-27 19:55:00 1103 183138
2015-10-27 19:56:00 1103 183138
2015-10-27 19:57:00 1103 183138
2015-10-27 19:58:00 1103 183138
2015-10-27 19:59:00 1103 183138
2015-10-27 20:00:00 1103 183138
2015-10-27 20:01:00 1103 183138
2015-10-27 20:02:00 1103 183138
2015-10-27 20:03:00 1103 183138
2015-10-27 20:04:00 1103 183138
2015-10-27 20:05:00 1103 183138
2015-10-27 20:06:00 1103 183138
2015-10-27 20:07:00 1103 183138
2015-10-27 20:08:00 1103 183138
2015-10-27 20:09:00 1103 183138
:
2015-12-31 23:59:00 1103 183139.3
my R code as below:
start_time <- as.POSIXct("2015-10-27 19:50",format="%Y-%m-%d %H:%M")
end_time <- as.POSIXct("2015-10-27 23:59",format="%Y-%m-%d %H:%M")
zoo_obj <- zoo(zz$meter_value,
order.by = seq.POSIXt(from = start_time, to = end_time ,by = "min"))
str(zoo_obj)
#‘zoo’ series from 2015-10-27 19:50:00 to 2015-10-27 20:09:00
# Data: num [1:20] 183138 183138 183138 183138 183138 ...
# Index: POSIXct[1:20], format: "2015-10-27 19:50:00" "2015-10-27 19:51:00" ...
mytsTT2 <- ts(zoo_obj)
str(mytsTT2)
#Time-Series [1:20] from 1 to 20: 183138 183138 183138 183138 183138 ...
# - attr(*, "index")= POSIXct[1:20], format: "2015-10-27 19:50:00" ...
I tried using "autoplot" autoplot(forecast(mytsTT2,1000))
How should i add the fitting and validation area in my autoplot?