Skip to content

Implement empirical distribution (ECDF) #60

Description

@devcrocod

Description

Add an EmpiricalDistribution class that constructs a cumulative distribution function (step function) from observed data. This enables visual comparison of empirical vs theoretical CDFs and non-parametric inference.

The KS test in kstats-hypothesis already computes an empirical CDF inline but does not expose it as a reusable distribution. A standalone class would allow reuse across the library and by end users.

Example usage

val data = doubleArrayOf(1.2, 3.4, 2.1, 5.6, 4.3)
val ecdf = EmpiricalDistribution(data)

ecdf.cdf(3.0)      // fraction of observations ≤ 3.0
ecdf.quantile(0.5) // median of the empirical distribution
ecdf.sample(100)   // resample from the observed data

Related to #53

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions