code: def percbend(x, y, beta=0.2):
      """
      Percentage bend correlation (Wilcox 1994).
  
      Parameters
      ----------
      x, y : array_like
          First and second set of observations. x and y must be independent.
      beta : float
          Bending constant for omega (0 <= beta <= 0.5).
  
      Returns
      -------
      r : float
          Percentage bend correlation coefficient.
      pval : float
          Two-tailed p-value.
  
      Notes
      -----
      Code inspired by Matlab code from Cyril Pernet and Guillaume Rousselet.
  
      References
      ----------
      .. [1] Wilcox, R.R., 1994. The percentage bend correlation coefficient.
         Psychometrika 59, 601–616. https://doi.org/10.1007/BF02294395
  
      .. [2] Pernet CR, Wilcox R, Rousselet GA. Robust Correlation Analyses:
         False Positive and Power Validation Using a New Open Source Matlab
         Toolbox. Frontiers in Psychology. 2012;3:606.
         doi:10.3389/fpsyg.2012.00606.
      """
      X = np.column_stack((x, y))
      nx = X.shape[0]
      M = np.tile(np.median(X, axis=0), nx).reshape(X.shape)
      W = np.sort(np.abs(X - M), axis=0)
      m = int((1 - beta) * nx)
      omega = W[m - 1, :]
      P = (X - M) / omega
      P[np.isinf(P)] = 0
      P[np.isnan(P)] = 0
  
      # Loop over columns
      a = np.zeros((2, nx))
      for c in [0, 1]:
          psi = P[:, c]
          i1 = np.where(psi < -1)[0].size
          i2 = np.where(psi > 1)[0].size
          s = X[:, c].copy()
          s[np.where(psi < -1)[0]] = 0
          s[np.where(psi > 1)[0]] = 0
          pbos = (np.sum(s) + omega[c] * (i2 - i1)) / (s.size - i1 - i2)
          a[c] = (X[:, c] - pbos) / omega[c]
  
      # Bend
      a[a <= -1] = -1
      a[a >= 1] = 1
  
      # Correlation coefficient
      a, b = a
      r = (a * b).sum() / np.sqrt((a**2).sum() * (b**2).sum())
      pval = _correl_pvalue(r, nx, k=0)
      return r, pval
  
imports: import warnings
  import numpy
  import pandas
  import pandas_flavor
  from scipy.spatial.distance import pdist, squareform
  from scipy.stats import pearsonr, spearmanr, kendalltau
  from pingouin.config import options
  from pingouin.power import power_corr
  from pingouin.multicomp import multicomp
  from pingouin.effsize import compute_esci
  from pingouin.utils import remove_na, _perm_pval, _postprocess_dataframe
  from pingouin.bayesian import bayesfactor_pearson
label_desc: Use image node_id 5 for calling a global function with example usage: percbend(x, y, beta) and returns: r,  pval