Class WeightedMedian

  • All Implemented Interfaces:
    Statistic

    public class WeightedMedian
    extends Object
    implements Statistic
    A weighted median of a sample is the 50% weighted percentile.It was first proposed by F. Y. Edgeworth in 1888.Like the median, it is useful as an estimator of central tendency, robust against outliers. It allows for non-uniform statistical weights related to, e.g., varying precision measurements in the sample.
    Since:
    2019/11/29
    See Also:
    Wikipedia: Weighted median
    • Constructor Detail

      • WeightedMedian

        public WeightedMedian​(double[] x,
                              double[] w)
        Finds the weighted median of an array. x and w are sorted.
        Parameters:
        x - the data
        w - the weights
    • Method Detail

      • value

        public double value()
        Description copied from interface: Statistic
        Get the value of the statistic.
        Specified by:
        value in interface Statistic
        Returns:
        the statistic
      • N

        public long N()
        Description copied from interface: Statistic
        Get the size of the sample.
        Specified by:
        N in interface Statistic
        Returns:
        the sample size
      • addData

        public void addData​(double... arg0)
        Description copied from interface: Statistic
        Recompute the statistic with more data, incrementally if possible.
        Specified by:
        addData in interface Statistic
        Parameters:
        arg0 - an array of new items