I have around 5 years of data points that show how sales revenue a business made each month it looks a little like this:

Jan 13: $101,323.51

Feb 13: $125,021.44


Jun 18: $431,032.99

I wish to predict the next six months of revenue using R.

Using a little research I have found a couple of techniques:

1) Use auto.arima function on the log of the sales.

ARIMAfit = auto.arima(log10(mydata), approximation=FALSE,trace=FALSE)

The log is to attempt to remove the upward trend to make it stationary. When I do this I get a differencing of order 1 as well. Looking at a plot of the differencing this also seems to make the data appear more stationary so presumably that is why it has a differencing of order 1. I plotted the ACF and PACF for the data and a few of the lags were out of the range but not enough to know if this method is applicable or not.

The forecast: forecast(ARIMAfit) is what I use to get the ARIMA model to forecast.

Alternatively we have,

2) Using the forecast function with HoltWinters or est so I do

forecast(HoltWinters(train), h = 6)


forecast(est(train), h = 6)

to predict the next 6 months.

Again these estimates appear reasonable but I don't know how to check.

What I did to test was to use 6 less months of data to try and see how the models predicted what had happened over the last 6 months. The results were actually quite close to the real thing.

Okay now my question:

Is there a good way to determine which method I should use (or if there is another I have not considered)?

If there is any questions please let me know I am new to this area really.


Since this is monthly sales revenue I expect there to be some kind of seasonal trend (people buying more in certain months and less in others) as well as increasing spend year on year.


1 Answer 1


If you work on logged data, be aware that simply taking the exponential of your point forecasts will not give the expectation on the original scale, for the same reason that the mean of a lognormal distribution is not simply $e^\mu$, but $e^{\mu+\frac{\sigma^2}{2}}$. Rob Hyndman is working on his new fable forecasting package that will automatically correct for biases induced by such Box-Cox transformations. Then again, the bias may not be much of a problem for you.

ARIMA and ETS (not "est") are good choices. Be sure to tell R that your time series are seasonal through ts(..., frequency=12), then seasonal models will automatically be considered. Don't use HoltWinters(), rather use ets(), which will likely do a better job at identifying a model than you or I could.

You are quite right to use a holdout sample to assess which method performs better. You might get even better by fitting and forecasting multiple models and then averaging the point forecasts for each future month. Few things improve forecasts more than simple averaging.

You may be interested in Forecasting: Principles and Practice.

EDIT to address your follow-up questions:

1) You say: By taking the exponential of the point forecasts you won't get the expected value on the original scale. I don't understand fully why this is not the case but is it likely to be a problem for me? If I predict 300,000 instead of 301,000 that is not really an issue but if it is 100,000 off for instance this is not good for me.

It shouldn't be a problem. Here is some toy data. The forecast on the original scale is the blue line, the one on a log scale the red line.


foo <- ts(3e5+1e5*rnorm(120),frequency=12)


In any case, I would recommend that you assess any bias in your forecast by calculating the Mean Error.

2) If you had to do one or the other would you use ets/ARIMA (taking whichever predicts better through the testing I mentioned) or average between the 2 predictions from both models?

I'd assess both methods as well as the average and go with whatever performs best, which will probably be the average.

3) Is it okay to log the data (to help make stationary) then let the ARIMA do the differencing if it finds it appropriate to do so?

Sure, you can do that. Whatever works, works.

4) When I do the tes model would it be better to do forecast(ets(train), h = 6) or forecast(ets(log10(train)), h = 6)?

As above: try both, assess the error on a holdout sample and use whatever works best.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.