'Private method to build the RHS matrix for estimation.
Columns are trend terms then lags.'

def _stackX(self, k_ar, trend):

    endog = self.endog
    X = lagmat(endog, maxlag=k_ar, trim='both')
    k_trend = util.get_trendorder(trend)
    if k_trend:
        X = add_trend(X, prepend=True, trend=trend)
    self.k_trend = k_trend
    return X
