

def _get_predict_out_of_sample(endog, p, q, k_trend, k_exog, start, errors, trendparam, exparams, arparams, maparams, steps, method, exog=None):
    '\n    Returns endog, resid, mu of appropriate length for out of sample\n    prediction.\n    '
    if q:
        resid = np.zeros(q)
        if ((start and ('mle' in method)) or ((start == p) and (not (start == 0)))):
            resid[:q] = errors[(start - q):start]
        elif start:
            resid[:q] = errors[((start - q) - p):(start - p)]
        else:
            resid[:q] = errors[(- q):]
    else:
        resid = None
    y = endog
    if (k_trend == 1):
        if (k_exog > 0):
            if ((np.ndim(exog) == 1) and (k_exog == 1)):
                exog = exog[:, None]
            elif (np.ndim(exog) == 1):
                if (len(exog) != k_exog):
                    raise ValueError('1d exog given and len(exog) != k_exog')
                exog = exog[None, :]
            X = lagmat(np.dot(exog, exparams), p, original='in', trim='both')
            mu = (trendparam * (1 - arparams.sum()))
            mu = (mu + (np.r_[(1, (- errors[::(- 1)]))] * X).sum(1)[:, None])
        else:
            mu = (trendparam * (1 - arparams.sum()))
            mu = np.array(([mu] * steps))
    elif (k_exog > 0):
        X = np.dot(exog, exparams)
        X = lagmat(X, p, original='in', trim='both')
        mu = (np.r_[(1, (- arparams[::(- 1)]))] * X).sum(1)[:, None]
    else:
        mu = np.zeros(steps)
    endog = np.zeros(((p + steps) - 1))
    if (p and start):
        endog[:p] = y[(start - p):start]
    elif p:
        endog[:p] = y[(- p):]
    return (endog, resid, mu)

dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/arima_model.py _get_predict_out_of_sample/VarMisuse@317/442 `arparams`->`errors`