  Even at the beginning of 2008, the economic recession of 2008/09 was not
being predicted. The failure to predict recessions is a persistent theme in
economic forecasting. The Survey of Professional Forecasters (SPF) provides
data on predictions made for the growth of total output, GDP, in the United
States for one, two, three and four quarters ahead since the end of the 1960s.
Over a three quarters ahead horizon, the mean prediction made for GDP growth
has never been negative over this period. The correlation between the mean SPF
three quarters ahead forecast and the data is very low, and over the most
recent 25 years is not significantly different from zero.
  Here, we show that the machine learning technique of random forests has the
potential to give early warning of recessions. We use a small set of
explanatory variables from financial markets which would have been available to
a forecaster at the time of making the forecast. We train the algorithm over
the 1970Q2-1990Q1 period, and make predictions one, three and six quarters
ahead. We then re-train over 1970Q2-1990Q2 and make a further set of
predictions, and so on. We did not attempt any optimisation of predictions,
using only the default input parameters to the algorithm we downloaded in the
package R.
  We compare the predictions made from 1990 to the present with the actual
data. One quarter ahead, the algorithm is not able to improve on the SPF
predictions. Three and six quarters ahead, the correlations between actual and
predicted are low, but they are very significantly different from zero.
Although the timing is slightly wrong, a serious downturn in the first half of
2009 could have been predicted six quarters ahead in late 2007. The algorithm
never predicts a recession when one did not occur.
  We obtain even stronger results with random forest machine learning
techniques in the case of the United Kingdom.
