def predict(self, params, start=None, end=None, exog=None, dynamic=False):
        method = getattr(self, 'method', 'mle')  # don't assume fit
        #params = np.asarray(params)

        # will return an index of a date
        start = self._get_predict_start(start, dynamic)
        end, out_of_sample = self._get_predict_end(end, dynamic)
        if out_of_sample and (exog is None and self.k_exog > 0):
            raise ValueError("You must provide exog for ARMAX")

        endog = self.endog
        resid = self.geterrors(params)
        k_ar = self.k_ar

        if exog is not None:
            # Note: we ignore currently the index of exog if it is available
            exog = np.asarray(exog)
            if self.k_exog == 1 and exog.ndim == 1:
                exog = exog[:, None]

        if out_of_sample != 0 and self.k_exog > 0:
            # we need the last k_ar exog for the lag-polynomial
            if self.k_exog > 0 and k_ar > 0 and not dynamic:
                # need the last k_ar exog for the lag-polynomial
                exog = np.vstack((self.exog[-k_ar:, self.k_trend:], exog))

        if dynamic:
            if self.k_exog > 0:
                # need the last k_ar exog for the lag-polynomial
                exog = np.vstack((self.exog[start - k_ar:, self.k_trend:], exog))
            #TODO: now that predict does dynamic in-sample it should
            # also return error estimates and confidence intervals
            # but how? len(endog) is not tot_obs
            out_of_sample += end - start + 1
            return _arma_predict_out_of_sample(params, out_of_sample, resid,
                                               k_ar, self.k_ma, self.k_trend,
                                               self.k_exog, endog, exog,
                                               start, method)

        predictedvalues = _arma_predict_in_sample(start, end, endog, resid,
                                                  k_ar, method)
        if out_of_sample:
            forecastvalues = _arma_predict_out_of_sample(params, out_of_sample,
                                                         resid, k_ar,
                                                         self.k_ma,
                                                         self.k_trend,
                                                         self.k_exog, endog,
                                                         exog, method=method)
            predictedvalues = np.r_[predictedvalues, forecastvalues]
        return predictedvalues
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/arima_model.py/ARMA.predict/original