def from_yw(self, acms):
        """Determine VAR model from autocorrelation matrices by solving the
        Yule-Walker equations.

        Parameters
        ----------
        acms : array, shape (n_lags, n_channels, n_channels)
            acms[l] contains the autocorrelation matrix at lag l. The highest
            lag must equal the model order.

        Returns
        -------
        self : :class:`VAR`
            The :class:`VAR` object to facilitate method chaining (see usage
            example).
        """
        if len(acms) != self.p + 1:
            raise ValueError("Number of autocorrelation matrices ({}) does not"
                             " match model order ({}) + 1.".format(len(acms),
                                                                   self.p))

        n_channels = acms[0].shape[0]

        acm = lambda l: acms[l] if l >= 0 else acms[-l].T

        r = np.concatenate(acms[1:], 0)

        rr = np.array([[acm(m-k) for k in range(self.p)]
                      for m in range(self.p)])
        rr = np.concatenate(np.concatenate(rr, -2), -1)

        c = sp.linalg.solve(rr, r)

        # calculate residual covariance
        r = acm(0)
        for k in range(self.p):
            bs = k * n_channels
            r -= np.dot(c[bs:bs + n_channels, :].T, acm(k + 1))

        self.coef = np.concatenate([c[m::n_channels, :]
                                    for m in range(n_channels)]).T
        self.rescov = r
        return self
Determine VAR model from autocorrelation matrices by solving the
        Yule-Walker equations.

        Parameters
        ----------
        acms : array, shape (n_lags, n_channels, n_channels)
            acms[l] contains the autocorrelation matrix at lag l. The highest
            lag must equal the model order.

        Returns
        -------
        self : :class:`VAR`
            The :class:`VAR` object to facilitate method chaining (see usage
            example).