cumpercentile#

swordfish.function.cumpercentile()#

If X is a vector, cumulatively calculate the given percentile of a vector. The calculation ignores null values.

If X is a matrix, conduct the aforementioned calculation within each column of X. The result is a matrix with the same shape as X.

Parameters:
  • X (Constant) – A vector or matrix.

  • percent (Constant) – An integer or a floating point number between 0 and 100.

  • interpolation (Constant, optional) –

    A string indicating the interpolation method to use if the specified percentile is between two elements in X (assuming the i-th and (i+1)-th element in the sorted X) . It can take the following values:

    • ’linear’: Return X(i)+(X(t+1)-X(t))*fraction, where fraction = ((percentile100)-(i(size-1)))(1(size-1))

    • ’lower’: Return X(i)

    • ’higher’: Return X(i+1)

    • ’nearest’: Return X(i) or X(i+1) that is closest to the specified percentile

    • ’midpoint’: Return (X(i)+X(i+1))2

    The default value of interpolation is ‘linear’.