def forecast(self, steps=1, exog=None, alpha=.05):
        if exog is not None:
            if self.k_exog == 1 and exog.ndim == 1:
                exog = exog[:, None]
            if exog.shape[0] != steps:
                raise ValueError("new exog needed for each step")
            # prepend in-sample exog observations
            if self.k_ar > 0:
                exog = np.vstack((self.model.exog[-self.k_ar:, self.k_trend:],
                                  exog))
        forecast = _arma_predict_out_of_sample(self.params, steps, self.resid,
                                               self.k_ar, self.k_ma,
                                               self.k_trend, self.k_exog,
                                               self.model.endog,
                                               exog, method=self.model.method)

        d = self.k_diff
        endog = self.model.data.endog[-d:]
        forecast = unintegrate(forecast, unintegrate_levels(endog, d))[d:]

        # get forecast errors
        fcerr = self._forecast_error(steps)
        conf_int = self._forecast_conf_int(forecast, fcerr, alpha)
        return forecast, fcerr, conf_int
Out-of-sample forecasts
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/arima_model.py/ARIMAResults.forecast