Main Content

Direct Forecasting

Perform direct forecasting using regularly sampled time series data

Use the directforecaster function to train a DirectForecaster model with regularly sampled time series data. The Statistics and Machine Learning Toolbox™ function creates a multistep forecasting model that uses a direct strategy, where a separate regression model is trained for each step of the forecasting horizon.

After creating a DirectForecaster model object, you can see how the model performs on observed test data by using the loss and predict object functions. You can then use the model to forecast at time steps beyond the available data by using the forecast object function.


compactReduce size of direct forecasting model (Since R2023b)
crossvalCross-validate direct forecasting model (Since R2023b)
lossLoss at each horizon step (Since R2023b)
predictPredict response at time steps in observed test data (Since R2023b)
forecastForecast response at time steps beyond available data (Since R2023b)
preparedPredictorsObtain prepared data used for training or testing in direct forecasting (Since R2023b)
cvlossLoss for partitioned data at each horizon step (Since R2023b)
cvpredictPredict response using cross-validated direct forecasting model (Since R2023b)
tspartitionPartition time series data for cross-validation (Since R2022b)


DirectForecasterFit direct forecasting model (Since R2023b)
CompactDirectForecasterCompact direct forecasting model (Since R2023b)
PartitionedDirectForecasterCross-validated direct forecasting model (Since R2023b)