code: def calc_delta(Y, Ygrid, X, m):
      """Plischke et al. (2013) delta index estimator (eqn 26) for d_hat."""
      N = len(Y)
      fy = gaussian_kde(Y, bw_method="silverman")(Ygrid)
      xr = rankdata(X, method="ordinal")
  
      d_hat = 0.0
      l_m = len(m) - 1
      for j in range(l_m):
          ix = np.where((xr > m[j]) & (xr <= m[j + 1]))[0]
          nm = len(ix)
  
          # if not np.all(np.equal(Y_ix, Y_ix[0])):
          Y_ix = Y[ix]
          if Y_ix.ptp() != 0.0:
              fyc = gaussian_kde(Y_ix, bw_method="silverman")(Ygrid)
              fy_ = np.abs(fy - fyc)
          else:
              fy_ = np.abs(fy)
  
          d_hat += (nm / (2 * N)) * np.trapz(fy_, Ygrid)
  
      return d_hat
  
file_path: SALib/src/SALib/analyze/delta.py
imports: from typing import Dict
  from scipy.stats import norm, gaussian_kde, rankdata
  import numpy
  from .None import common_args
  from ..util import read_param_file, ResultDict
label_desc: Use image node_id 2 for calling a global function with example usage: calc_delta(Y, Ygrid, X, m) and returns: d_hat