# Comparing a ARIMA model with random forest model for time series data

I am comparing a ARIMA model with a random forest model for time series data with 288 monthly observations. You can see the link for the data here (Used house price index as the time series).

The data looks like follows:

There seems to be a clear trend based on above data.

Using auto.arima function, I found following model as the best model (taking first 250 observations).

Now re-fitting the best model(s) without approximations...

ARIMA(2,2,1)                    : 26.75391

Best model: ARIMA(2,2,1)


Then I forecasted the last 38 observations using the above model(predicting the trough around 2009). The MSE for the prediction is 85.24.

This is how the prediction for arima looks like when it superimpose in the original plot(fitting using 250 observations and predicting using 38 observations)

This is the comparison of the prediction with the actual 38 observations.

Next I fitted a random forest model by taking first lag of price as the predictor.

data_lag=lag(data,1)
require(randomForest)
data_rand=data.frame(data,data_lag)
set.seed(123)
rand2=randomForest(data~data_lag,data=data_rand[1:250,],ntree=1000)


I obtained the MSE as 2.92 when I used this model to forecast the last 38 observations. The actual and forecasted values are like follows:

The random forest model has done a good job in predicting the trough. But the prediction of other observations are not that good.

Based on this analysis, I wanted to know whether I can improve the results of ARIMA model. Also will random forest always give the better results than time series models ?

Any advice would be highly appreciated.

• Please include $x$ axis annotations, and possibly constrain $y$ axes to be on the same scale. As it is, it's unclear to me whether the second graph is the continuation of the first one, or whether there is an overlap. I also don't see for how many periods you are forecasting out. Oct 14, 2020 at 5:18
• @StephanKolassa Thank you for the comment. I edited the question. Basically I am forecasting the trough during 2009(for 38 periods/observations) Oct 17, 2020 at 1:30