

def predict(self, params, start=None, end=None, exog=None, typ='linear', dynamic=False):
    if isinstance(start, (string_types, datetime)):
        start = _index_date(start, self.data.dates)
    if (typ == 'linear'):
        if ((not dynamic) or ((start != (self.k_ar + self.k_diff)) and (start is not None))):
            return super(ARIMA, self).predict(params, start, end, exog, dynamic)
        else:
            q = self.k_ma
            self.k_ma = 0
            predictedvalues = super(ARIMA, self).predict(params, start, end, exog, dynamic)
            self.k_ma = q
            return predictedvalues
    elif (typ == 'levels'):
        endog = self.data.endog
        if (not dynamic):
            predict = super(ARIMA, self).predict(params, start, end, exog, dynamic)
            start = self._get_predict_start(start, dynamic)
            (end, out_of_sample) = self._get_predict_end(end)
            d = self.k_diff
            if ('mle' in self.method):
                start += (d - 1)
                end += (d - 1)
                if out_of_sample:
                    fv = (predict[:(- out_of_sample)] + endog[start:(end + 1)])
                    if (d == 2):
                        fv += np.diff(endog[(start - 1):(end + 1)])
                    levels = unintegrate_levels(endog[(- d):], d)
                    fv = np.r_[(fv, unintegrate(predict[(- out_of_sample):], levels)[d:])]
                else:
                    fv = (predict + endog[start:(end + 1)])
                    if (d == 2):
                        fv += np.diff(endog[(start - 1):(end + 1)])
            else:
                k_ar = self.k_ar
                if out_of_sample:
                    fv = (predict[:(- out_of_sample)] + endog[max(start, (self.k_ar - 1)):((end + k_ar) + 1)])
                    if (d == 2):
                        fv += np.diff(endog[(start - 1):(end + 1)])
                    levels = unintegrate_levels(endog[(- d):], d)
                    fv = np.r_[(fv, unintegrate(predict[(- out_of_sample):], levels)[d:])]
                else:
                    fv = (predict + endog[max(start, k_ar):((end + k_ar) + 1)])
                    if (d == 2):
                        fv += np.diff(endog[(start - 1):(end + 1)])
        elif ((start == (self.k_ar + self.k_diff)) or (start is None)):
            p = self.k_ar
            q = self.k_ma
            k_exog = self.k_exog
            k_trend = self.k_trend
            k_diff = self.k_diff
            (trendparam, exparams, arparams, maparams) = _unpack_params(params, (p, q), k_trend, k_exog, reverse=True)
            self.k_ma = 0
            predict = super(ARIMA, self).predict(params, start, end, exog, dynamic)
            if (not start):
                start = self._get_predict_start(start, dynamic)
                start += k_diff
            self.k_ma = q
            return (endog[(start - 1)] + np.cumsum(predict))
        else:
            predict = super(ARIMA, self).predict(params, start, end, exog, dynamic)
            return (endog[(start - 1)] + np.cumsum(predict))
        return fv
    else:
        raise ValueError(('typ %s not understood' % typ))

dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/arima_model.py ARIMA.predict/original