# Choosing the right size of an out of sample data

I am beginner in forecasting, especially forecasting with R and I am really willing to improve my knowledge.

Recently, I started practicing electricity consumption time series forecasting.

The first barrier I faced is the choice of out of sample data for assessing the forecast accuracy of the forecast model i will be using (regression with ARIMA errors).

I have data for 147 months and I want to forecast the next 24 months, for the period June 2013 to January 2015. Furthermore, I have read in @RobHyndman's online text book

Hyn­d­man, R.J. and Athana­sopou­los, G. (2013),
Forecasting: principles and practice,
(accessed 28 May 2013), section 2.5
under 'Training and test sets', that:

size of the test set is typ­i­cally about 20% of the total sam­ple, although this value depends on how long the sam­ple is and how far ahead you want to fore­cast

If I divide the dataset with 20% of it being the out-of-sample data, the forecast model applied to the in-sample data is not quite accurate, since I guess it fails to capture the recent trend, (which began in the middle of the last year), of decreased electricity consumption due to a significantly raised electricity tariff.

Can you possibly give me instruction on what would be considered appropriate size of the out of sample data. I also tried with 7 months of out-of-sample data, but I am afraid that there might be an overfitting issue. Is that right?

• Can you give the link to the chapter of the book you mean, and state roughly where it is to be found? – Glen_b May 28 '13 at 12:14
• otexts.com/fpp/2/5/...there it is:):) – Mari May 28 '13 at 15:30
• Your link is mangled, sorry, but it was enough information to quickly find it. I have included a full reference and link in your question so people can find the context in which the statement was made. – Glen_b May 28 '13 at 23:05

Not really my area of expertise but I think one answer should be “Nothing!” You could of course try to improve the model or try other techniques (but if you begin tuning the model on the basis of its performance in the test set, you still run the risk of “overfitting”) but changing the size of the test set does not seem to directly address this problem.

If today was still 2011 and we were trying to predict electricity consumption until 2013, this model would give us some seriously misleading predictions. This is precisely the type of things out-of-sample evaluation is supposed to pick up. You can look at it retrospectively today and interpret it as a trend that started last year because of some change to the electricity market but the conclusion remains the same: This model did not allow you to see it coming.

Also, if you read the sentence carefully you will notice that Rob Hyndman also stresses that size of the test set should depend on how far ahead you want to forecast. Intuitively, if you want to predict 24 months, a test set of 7 months is too short, no matter whether you have 100 or 10000 months of past data. For example, a good model of seasonal changes in your data could look very good even if it is unable to predict any year-on-year trend.

• So basicly, whichever forecasting method i choose, with the same predictors, respecting the general "out of sample data size" rule, looking retrospectively today will not capture the effect of change in consumption due to tariff modifications? – Mari May 28 '13 at 15:20
• I have no idea. What I am saying is that if this particular forecasting method did not predict it, putting this fact under the rug by redefining the test after you looked at the results will not make your model better next time around and leaves you with no idea of how good it will really be in the next 24 months. – Gala May 28 '13 at 15:34

20% of 147 months is 30 months, which means that at you have over 2 years of data. If the trend began in the middle of last year, then it exists within that 2 year time frame.

If you feel that your forecast is not capturing your trend, then it is probably because you smoothed too much. If you used the average instead of the drift or seasonal method, then it unlikely went uncaptured. The problem isn't with your sample size but with your method of forecasting - and specifically how much smoothing you are doing.