ben519 / mltools

Exploratory and diagnostic machine learning tools for R
Other
72 stars 26 forks source link

empirical_cdf() gives wrong answer when ubounds contains duplicates #5

Closed ben519 closed 7 years ago

ben519 commented 7 years ago

Example:

vec <- c(0.5, 0.5, 0.6, 1.2, 1.8, 2.0, 2.1, 2.1, 4.5)
empirical_cdf(vec, ubounds = c(1, 2, 2, 5))

   UpperBound N.cum       CDF
1:          1     3 0.3333333
2:          2     7 0.7777778
3:          2    11 1.2222222
4:          5    14 1.5555556