InversePropensityWeighting.weighted_percentile#
- InversePropensityWeighting.weighted_percentile(data, weights, perc)[source]#
Compute a weighted percentile of the data.
Sorts
dataandweightstogether, builds a weighted empirical CDF, and linearly interpolates to find the value at the requested percentile.- Parameters:
- Returns:
The interpolated data value at the given weighted percentile.
- Return type:
- Raises:
ValueError – If
percis not between 0 and 1.