Class Skewness

  • All Implemented Interfaces:
    Statistic

    public class Skewness
    extends Object
    implements Statistic
    Skewness is a measure of the asymmetry of the probability distribution. A distribution may either be positively or negatively skewed. For positive skew (or right-skewed), the right tail is longer. The mass of the distribution is concentrated on the left. For negative skew (or left-skewed), the left tail is longer. The mass of the distribution is concentrated on the right. The definition is:
    γ = E[((X - E(X)) / σ)3]
    This implementation uses Chan's update formula to incrementally compute the new statistic.

    The R equivalent function is skewness.

    See Also:
    • Constructor Detail

      • Skewness

        public Skewness()
        Construct an empty Skewness calculator.
      • Skewness

        public Skewness​(double[] data)
        Construct a Skewness calculator, initialized with a sample.
        Parameters:
        data - a sample
      • Skewness

        public Skewness​(Skewness that)
        Copy constructor.
        Parameters:
        that - a Skewness calculator
    • Method Detail

      • sample

        public double sample()
        Get the sample skewness (biased estimator).
        Returns:
        the sample skewness
      • mean

        public double mean()
        Get the sample mean.
        Returns:
        the mean
      • variance

        public double variance()
        Get the (unbiased) variance.
        Returns:
        the (unbiased) variance
      • addData

        public void addData​(double... data)
        Description copied from interface: Statistic
        Recompute the statistic with more data, incrementally if possible.
        Specified by:
        addData in interface Statistic
        Parameters:
        data - an array of new items
      • 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