# Buggy code
def fit(self, maxlags=None, method="ols", ic=None, trend="c", verbose=False):
    # todo: this code is only supporting deterministic terms as exog.
    # This means that all exog-variables have lag 0. If dealing with
    # different exogs is necessary, a `lags_exog`-parameter might make
    # sense (e.g. a sequence of ints specifying lags).
    # Alternatively, leading zeros for exog-variables with smaller number
    # of lags than the maximum number of exog-lags might work.
    """
    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
    -----
    Lütkepohl pp. 146-153

    Returns
    -------
    est : VARResultsWrapper
    """
    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 ValueError(
                "%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))
    else:
        if 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

    # add exog to data.xnames (necessary because the length of xnames also
    # determines the allowed size of VARResults.params)
    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)


# Traceback (ValueError)
In [34]: results._results.cov_params.shape
Out[34]: (36, 36)

In [37]: results.cov_params

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-37-14357748fa96> in <module>()

<snip>
ValueError: Shape of passed values is (36, 36), indices imply (12, 12)

# Fixed code
def fit(self, maxlags=None, method="ols", ic=None, trend="c", verbose=False):
    # todo: this code is only supporting deterministic terms as exog.
    # This means that all exog-variables have lag 0. If dealing with
    # different exogs is necessary, a `lags_exog`-parameter might make
    # sense (e.g. a sequence of ints specifying lags).
    # Alternatively, leading zeros for exog-variables with smaller number
    # of lags than the maximum number of exog-lags might work.
    """
    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
    -----
    Lütkepohl pp. 146-153

    Returns
    -------
    est : VARResultsWrapper
    """
    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 ValueError(
                "%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))
    else:
        if 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

    # add exog to data.xnames (necessary because the length of xnames also
    # determines the allowed size of VARResults.params)
    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:]
        )
    self.data.cov_names = [
        ".".join((str(yn), str(xn)))
        for xn in self.data.xnames
        for yn in self.data.ynames
    ]
    return self._estimate_var(lags, trend=trend)