def test_acf_2_lags(self): c = np.zeros((2, 2, 2)) c[0] = np.array([[.2, .1], [.15, .15]]) c[1] = np.array([[.1, .9], [0, .1]]) acf = var_acf(c, np.eye(2), 3) gamma = np.zeros((6, 6)) gamma[:2, :2] = acf[0] gamma[2:4, 2:4] = acf[0] gamma[4:6, 4:6] = acf[0] gamma[2:4, :2] = acf[1].T gamma[4:, :2] = acf[2].T gamma[:2, 2:4] = acf[1] gamma[:2, 4:] = acf[2] recovered = np.dot(gamma[:2, 2:], np.linalg.inv(gamma[:4, :4])) recovered = [recovered[:, 2 * i:2 * (i + 1)] for i in range(2)] recovered = np.array(recovered) assert_allclose(recovered, c, atol=1e-7)