code: def integral_approx_estimator(x, y):
      
      a, b = (0., 0.)
      x = np.array(x)
      y = np.array(y)
      idx, idy = (np.argsort(x), np.argsort(y))
  
      for x1, x2, y1, y2 in zip(x[[idx]][:-1], x[[idx]][1:], y[[idx]][:-1], y[[idx]][1:]):
          if x1 != x2 and y1 != y2:
              a = a + np.log(np.abs((y2 - y1) / (x2 - x1)))
  
      for x1, x2, y1, y2 in zip(x[[idy]][:-1], x[[idy]][1:], y[[idy]][:-1], y[[idy]][1:]):
          if x1 != x2 and y1 != y2:
              b = b + np.log(np.abs((x2 - x1) / (y2 - y1)))
  
      return (a - b)/len(x)
docs: Integral approximation estimator for causal inference.
  
      :param x: input variable x 1D
      :param y: input variable y 1D
      :return: Return value of the IGCI model >0 if x->y otherwise if return <0