code: def test_bivariate_eg_alternative(data, trend, method):
      if isinstance(data, pd.DataFrame):
          y, w = data.y, data.w
      else:
          w = data[:, -1]
          y = data[:, 1]
  
      test_yw = engle_granger(
          y, w, trend=trend, method=method, max_lags=17
      )
      key = (method, trend, "y")
      assert_allclose(test_yw.stat, ALT_TEST_VALUES[key][0], rtol=1e-4)
      assert_allclose(
          test_yw.rho, 1 + ALT_TEST_VALUES[key][2], rtol=1e-4
      )
      assert_allclose(
          test_yw.pvalue, ALT_TEST_VALUES[key][1], atol=1e-3
      )
      assert test_yw.lags == ALT_TEST_VALUES[key][3]
      assert test_yw.max_lags == 17
  
      test_wy = engle_granger(
          w, y, trend=trend, method=method, max_lags=17
      )
      key = (method, trend, "w")
      assert_allclose(test_wy.stat, ALT_TEST_VALUES[key][0], rtol=1e-4)
      assert_allclose(
          test_wy.rho, 1 + ALT_TEST_VALUES[key][2], rtol=1e-4
      )
      assert_allclose(
          test_wy.pvalue, ALT_TEST_VALUES[key][1], atol=1e-3
      )
      assert test_wy.lags == ALT_TEST_VALUES[key][3]
  
file_path: arch/arch/tests/unitroot/test_engle_granger.py
imports: import numpy
  from numpy.testing import assert_allclose
  import pandas
  import pytest
  from statsmodels.iolib.summary import Summary
  from arch.unitroot._engle_granger import engle_granger_cv, engle_granger_pval
  from arch.unitroot._shared import ResidualCointegrationTestResult, _cross_section
  from arch.unitroot.cointegration import engle_granger
label_desc: Use image node_id 3 for calling a global function with example usage: test_bivariate_eg_alternative(data, trend, method) without return types