-
Notifications
You must be signed in to change notification settings - Fork 15
Empirical Distribution (ECDF)
Esteban Zapata Rojas edited this page Jan 8, 2019
·
1 revision
This distribution is an implementation of the empirical distribution used by the Kolmogorov-Smirnov Test, which compares two sets of distributions to determine if both are the same or not. More details, here: https://en.wikipedia.org/wiki/Empirical_distribution_function.
In order to initialize this distribution, you need to pass the samples using the samples:
keyword. An object that responds to Enumerable methods is expected.
1] pry(main)> Distribution::Empirical
=> Statistics::Distribution::Empirical
[2] pry(main)> Distribution::Empirical.new(samples: [1, 2, 3, 4, 5, 6, 7])
=> #<Statistics::Distribution::Empirical:0x00007f4167bb6700 @samples=[1, 2, 3, 4, 5, 6, 7]>
This function calculates the probablity P(x <= X)
for the specified keyword value x:
.
[3] pry(main)> empirical = Distribution::Empirical.new(samples: [1, 2, 3, 4, 5, 6, 7])
=> #<Statistics::Distribution::Empirical:0x00007f4166fc2750 @samples=[1, 2, 3, 4, 5, 6, 7]>
[4] pry(main)> empirical.cumulative_function(x: 3)
=> 0.42857142857142855