'Fit the VAR model
Parameters
maxlags : int
Maximum number of lags to check for order selection, defaults to
12 * (nobs/100.)**(1./4), see select_order function
method : {\'ols\'}
Estimation method to use
ic : {\'aic\', \'fpe\', \'hqic\', \'bic\', None}
Information criterion to use for VAR order selection.
aic : Akaike
fpe : Final prediction error
hqic : Hannan-Quinn
bic : Bayesian a.k.a. Schwarz
verbose : bool, default False
Print order selection output to the screen
trend : str {"c", "ct", "ctt", "nc"}
"c" - add constant
"ct" - constant and trend
"ctt" - constant, linear and quadratic trend
"nc" - co constant, no trend
Note that these are prepended to the columns of the dataset.
Notes
Lutkepohl pp. 146-153
Returns
est : VARResultsWrapper'

def fit(self, maxlags=None, method='ols', ic=None, trend='c', verbose=False):

    lags = maxlags
    if (trend not in ['c', 'ct', 'ctt', 'nc']):
        raise ValueError("trend    '{}'    not    supported    for    VAR".format(trend))
    if (ic is not None):
        selections = self.select_order(maxlags=maxlags)
        if (not hasattr(selections, ic)):
            raise Exception(('%s    not    recognized,    must    be    among    %s' % (ic, sorted(selections))))
        lags = getattr(selections, ic)
        if verbose:
            print(selections)
            print(('Using    %d    based    on    %s    criterion' % (lags, ic)))
    elif (lags is None):
        lags = 1
    k_trend = util.get_trendorder(trend)
    self.exog_names = util.make_lag_names(self.endog_names, lags, k_trend)
    self.nobs = (self.n_totobs - lags)
    if (self.exog is not None):
        x_names_to_add = [('exog%d' % i) for i in range(self.exog.shape[1])]
        self.data.xnames = ((self.data.xnames[:k_trend] + x_names_to_add) + self.data.xnames[k_trend:])
    return self._estimate_var(lags, trend=trend)
