'Get the errors of the ARMA process.
Parameters
params : array-like
The fitted ARMA parameters
order : array-like
3 item iterable, with the number of AR, MA, and exogenous
parameters, including the trend'

def geterrors(self, params):

    params = np.asarray(params)
    (k_ar, k_ma) = (self.k_ar, self.k_ma)
    k = (self.k_exog + self.k_trend)
    method = getattr(self, 'method', 'mle')
    if ('mle' in method):
        (y, k, nobs, k_ar, k_ma, k_lags, newparams, Z_mat, m, R_mat, T_mat, paramsdtype) = KalmanFilter._init_kalman_state(params, self)
        errors = KalmanFilter.geterrors(y, k, k_ar, k_ma, k_lags, nobs, Z_mat, m, R_mat, T_mat, paramsdtype)
        if isinstance(errors, tuple):
            errors = errors[0]
    else:
        y = self.endog.copy()
        k = (self.k_exog + self.k_trend)
        if (k > 0):
            y -= dot(self.exog, params[:k])
        k_ar = self.k_ar
        k_ma = self.k_ma
        (trendparams, exparams, arparams, maparams) = _unpack_params(params, (k_ar, k_ma), self.k_trend, self.k_exog, reverse=False)
        (b, a) = (np.r_[(1, (- arparams))], np.r_[(1, maparams)])
        zi = zeros(max(k_ar, k_ma))
        for i in range(k_ar):
            zi[i] = sum(((- b[:(i + 1)][::(-1)]) * y[:(i + 1)]))
        e = lfilter(b, a, y, zi=zi)
        errors = e[0][k_ar:]
    return errors.squeeze()
