Univariate time series forecasting

With this task, the objective is to produce a univariate forecast for the surface temperature, focusing on choosing either an exponential smoothing model, an ARIMA model, or an ensemble of methods, including a neural net. We'll train the models and determine their predictive accuracy on an out-of-time test set, just like we've done in other learning endeavors. The following code creates the train and test sets:

> temp_ts <- ts(climate$Temp, start = 1919, frequency = 1)> train <- window(temp_ts, end = 2007)> test <- window(temp_ts, start = 2008)

To build our exponential smoothing model, we'll use the ets() function found in the forecast package. The function will find the best model with the lowest AIC:

Get Mastering Machine Learning with R - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.