code: def plotting_positions(
      data, alpha=0.4, beta=0.4, axis=0, masknan=False
  ):
      """Returns the plotting positions (or empirical percentile points) for the
      data.
      Plotting positions are defined as (i-alpha)/(n+1-alpha-beta), where:
          - i is the rank order statistics (starting at 1)
          - n is the number of unmasked values along the given axis
          - alpha and beta are two parameters.
  
      Typical values for alpha and beta are:
          - (0,1)    : *p(k) = k/n* : linear interpolation of cdf (R, type 4)
          - (.5,.5)  : *p(k) = (k-1/2.)/n* : piecewise linear function (R, type 5)
            (Bliss 1967: "Rankit")
          - (0,0)    : *p(k) = k/(n+1)* : Weibull (R type 6), (Van der Waerden 1952)
          - (1,1)    : *p(k) = (k-1)/(n-1)*. In this case, p(k) = mode[F(x[k])].
            That's R default (R type 7)
          - (1/3,1/3): *p(k) = (k-1/3)/(n+1/3)*. Then p(k) ~ median[F(x[k])].
            The resulting quantile estimates are approximately median-unbiased
            regardless of the distribution of x. (R type 8), (Tukey 1962)
          - (3/8,3/8): *p(k) = (k-3/8)/(n+1/4)*.
            The resulting quantile estimates are approximately unbiased
            if x is normally distributed (R type 9) (Blom 1958)
          - (.4,.4)  : approximately quantile unbiased (Cunnane)
          - (.35,.35): APL, used with PWM
  
      Parameters
      ----------
      x : sequence
          Input data, as a sequence or array of dimension at most 2.
      prob : sequence
          List of quantiles to compute.
      alpha : {0.4, float} optional
          Plotting positions parameter.
      beta : {0.4, float} optional
          Plotting positions parameter.
  
      Notes
      -----
      I think the adjustments assume that there are no ties in order to be a reasonable
      approximation to a continuous density function. TODO: check this
  
      References
      ----------
      unknown,
      dates to original papers from Beasley, Erickson, Allison 2009 Behav Genet
      """
      if isinstance(data, np.ma.MaskedArray):
          if axis is None or data.ndim == 1:
              return stats.mstats.plotting_positions(
                  data, alpha=alpha, beta=beta
              )
          else:
              return ma.apply_along_axis(
                  stats.mstats.plotting_positions,
                  axis,
                  data,
                  alpha=alpha,
                  beta=beta,
              )
      if masknan:
          nanmask = np.isnan(data)
          if nanmask.any():
              marr = ma.array(data, mask=nanmask)
              # code duplication:
              if axis is None or data.ndim == 1:
                  marr = stats.mstats.plotting_positions(
                      marr, alpha=alpha, beta=beta
                  )
              else:
                  marr = ma.apply_along_axis(
                      stats.mstats.plotting_positions,
                      axis,
                      marr,
                      alpha=alpha,
                      beta=beta,
                  )
              return ma.filled(marr, fill_value=np.nan)
  
      data = np.asarray(data)
      if data.size == 1:  # use helper function instead
          data = np.atleast_1d(data)
          axis = 0
      if axis is None:
          data = data.ravel()
          axis = 0
      n = data.shape[axis]
      if data.ndim == 1:
          plpos = np.empty(data.shape, dtype=float)
          plpos[data.argsort()] = (np.arange(1, n + 1) - alpha) / (
              n + 1.0 - alpha - beta
          )
      else:
          # nd assignment instead of second argsort does not look easy
          plpos = (data.argsort(axis).argsort(axis) + 1.0 - alpha) / (
              n + 1.0 - alpha - beta
          )
      return plpos
  
file_path: statsmodels/statsmodels/sandbox/stats/stats_mstats_short.py
imports: import numpy
  from numpy import ma
  from scipy import stats
label_desc: Use image node_id 3 for calling a global function with example usage: plotting_positions(data, alpha, beta, axis, masknan) and returns: plpos, stats, ma, ma