1

I have 365 days of data ranging from 0 to 100.

Shown in blue are the predicted values. The red line shows the actual values over the validation period. The solid line predicts the training data while the dashed line predicts the testing data.

How can I get more accurate predictions when my data has such extreme values?

enter image description here

My MAE is approx. 25 which is what I am hoping to improve:

> accuracy(hwin.pred, valid.ts)
                   ME     RMSE      MAE  MPE MAPE      MASE       ACF1 Theil's U
Training set 2.093110 32.90566 26.46510 -Inf  Inf 0.8101071 0.03867724        NA
Test set     2.473318 29.20464 23.04994 -Inf  Inf 0.7055677 0.01577363         0

My code uses 365 days of data (as stated above) so I didn't want to provide all of it here in the interest of brevity but I can do so if it would help.

The following is my actual code that produced the above plot (excepting the data):

library("forecast")

ratios.ts <- ts(d[,2], frequency = 7)

nValid <- 21
nTrain <- length(ratios.ts) - nValid
train.ts <- window(ratios.ts, start = c(1, 1), end = c(1, nTrain))
valid.ts <- window(ratios.ts, start = c(1, nTrain + 1), end = c(1, + nTrain + nValid))

hwin <- ets(train.ts, model = "ANA")
hwin.pred <- forecast(hwin, h = nValid, level = 0)

plot(hwin.pred, ylim = c(-20,120), ylab = "Ratio", xlab = "Date", bty = "l", xaxt = "n", main = "", flty = 2)
lines(hwin.pred$fitted, lwd = 2, col = "blue")
lines(valid.ts, col = "red")

accuracy(hwin.pred, valid.ts)

0 Answers0