def _ecdf_formal(x, data):
"""
Compute the values of the formal ECDF generated from `data` at x.
I.e., if F is the ECDF, return F(x).
Parameters
----------
x : array_like
Positions at which the formal ECDF is to be evaluated.
data : array_like
*Sorted* data set to use to generate the ECDF.
Returns
-------
output : float or ndarray
Value of the ECDF at `x`.
"""
output = np.empty_like(x)
for i, x_val in enumerate(x):
j = 0
while j < len(data) and x_val >= data[j]:
j += 1
output[i] = j
return output / len(data)
评论列表
文章目录