SummaryStatistics
org.apache.commons.math3.stat.descriptive

Class SummaryStatistics

    • Constructor Detail

      • SummaryStatistics

        public SummaryStatistics()
        Construct a SummaryStatistics instance
    • Method Detail

      • addValue

        public void addValue(double value)
        Add a value to the data
        Parameters:
        value - the value to add
      • getN

        public long getN()
        Returns the number of available values
        Specified by:
        getN in interface StatisticalSummary
        Returns:
        The number of available values
      • getSum

        public double getSum()
        Returns the sum of the values that have been added
        Specified by:
        getSum in interface StatisticalSummary
        Returns:
        The sum or Double.NaN if no values have been added
      • getSumsq

        public double getSumsq()
        Returns the sum of the squares of the values that have been added.

        Double.NaN is returned if no values have been added.

        Returns:
        The sum of squares
      • getMean

        public double getMean()
        Returns the mean of the values that have been added.

        Double.NaN is returned if no values have been added.

        Specified by:
        getMean in interface StatisticalSummary
        Returns:
        the mean
      • getStandardDeviation

        public double getStandardDeviation()
        Returns the standard deviation of the values that have been added.

        Double.NaN is returned if no values have been added.

        Specified by:
        getStandardDeviation in interface StatisticalSummary
        Returns:
        the standard deviation
      • getVariance

        public double getVariance()
        Returns the (sample) variance of the available values.

        This method returns the bias-corrected sample variance (using n - 1 in the denominator). Use getPopulationVariance() for the non-bias-corrected population variance.

        Double.NaN is returned if no values have been added.

        Specified by:
        getVariance in interface StatisticalSummary
        Returns:
        the variance
      • getPopulationVariance

        public double getPopulationVariance()
        Returns the population variance of the values that have been added.

        Double.NaN is returned if no values have been added.

        Returns:
        the population variance
      • getMax

        public double getMax()
        Returns the maximum of the values that have been added.

        Double.NaN is returned if no values have been added.

        Specified by:
        getMax in interface StatisticalSummary
        Returns:
        the maximum
      • getMin

        public double getMin()
        Returns the minimum of the values that have been added.

        Double.NaN is returned if no values have been added.

        Specified by:
        getMin in interface StatisticalSummary
        Returns:
        the minimum
      • getGeometricMean

        public double getGeometricMean()
        Returns the geometric mean of the values that have been added.

        Double.NaN is returned if no values have been added.

        Returns:
        the geometric mean
      • getSumOfLogs

        public double getSumOfLogs()
        Returns the sum of the logs of the values that have been added.

        Double.NaN is returned if no values have been added.

        Returns:
        the sum of logs
      • getSecondMoment

        public double getSecondMoment()
        Returns a statistic related to the Second Central Moment. Specifically, what is returned is the sum of squared deviations from the sample mean among the values that have been added.

        Returns Double.NaN if no data values have been added and returns 0 if there is just one value in the data set.

        Returns:
        second central moment statistic
      • toString

        public String toString()
        Generates a text report displaying summary statistics from values that have been added.
        Overrides:
        toString in class Object
        Returns:
        String with line feeds displaying statistics
      • clear

        public void clear()
        Resets all statistics and storage
      • equals

        public boolean equals(Object object)
        Returns true iff object is a SummaryStatistics instance and all statistics have the same values as this.
        Overrides:
        equals in class Object
        Parameters:
        object - the object to test equality against.
        Returns:
        true if object equals this
      • hashCode

        public int hashCode()
        Returns hash code based on values of statistics
        Overrides:
        hashCode in class Object
        Returns:
        hash code
      • getSumImpl

        public StorelessUnivariateStatistic getSumImpl()
        Returns the currently configured Sum implementation
        Returns:
        the StorelessUnivariateStatistic implementing the sum
      • setSumImpl

        public void setSumImpl(StorelessUnivariateStatistic sumImpl)                throws MathIllegalStateException

        Sets the implementation for the Sum.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        sumImpl - the StorelessUnivariateStatistic instance to use for computing the Sum
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n >0)
      • getSumsqImpl

        public StorelessUnivariateStatistic getSumsqImpl()
        Returns the currently configured sum of squares implementation
        Returns:
        the StorelessUnivariateStatistic implementing the sum of squares
      • setSumsqImpl

        public void setSumsqImpl(StorelessUnivariateStatistic sumsqImpl)                  throws MathIllegalStateException

        Sets the implementation for the sum of squares.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        sumsqImpl - the StorelessUnivariateStatistic instance to use for computing the sum of squares
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n > 0)
      • getMinImpl

        public StorelessUnivariateStatistic getMinImpl()
        Returns the currently configured minimum implementation
        Returns:
        the StorelessUnivariateStatistic implementing the minimum
      • setMinImpl

        public void setMinImpl(StorelessUnivariateStatistic minImpl)                throws MathIllegalStateException

        Sets the implementation for the minimum.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        minImpl - the StorelessUnivariateStatistic instance to use for computing the minimum
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n > 0)
      • getMaxImpl

        public StorelessUnivariateStatistic getMaxImpl()
        Returns the currently configured maximum implementation
        Returns:
        the StorelessUnivariateStatistic implementing the maximum
      • setMaxImpl

        public void setMaxImpl(StorelessUnivariateStatistic maxImpl)                throws MathIllegalStateException

        Sets the implementation for the maximum.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        maxImpl - the StorelessUnivariateStatistic instance to use for computing the maximum
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n > 0)
      • getSumLogImpl

        public StorelessUnivariateStatistic getSumLogImpl()
        Returns the currently configured sum of logs implementation
        Returns:
        the StorelessUnivariateStatistic implementing the log sum
      • setSumLogImpl

        public void setSumLogImpl(StorelessUnivariateStatistic sumLogImpl)                   throws MathIllegalStateException

        Sets the implementation for the sum of logs.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        sumLogImpl - the StorelessUnivariateStatistic instance to use for computing the log sum
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n > 0)
      • getGeoMeanImpl

        public StorelessUnivariateStatistic getGeoMeanImpl()
        Returns the currently configured geometric mean implementation
        Returns:
        the StorelessUnivariateStatistic implementing the geometric mean
      • setGeoMeanImpl

        public void setGeoMeanImpl(StorelessUnivariateStatistic geoMeanImpl)                    throws MathIllegalStateException

        Sets the implementation for the geometric mean.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        geoMeanImpl - the StorelessUnivariateStatistic instance to use for computing the geometric mean
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n > 0)
      • getMeanImpl

        public StorelessUnivariateStatistic getMeanImpl()
        Returns the currently configured mean implementation
        Returns:
        the StorelessUnivariateStatistic implementing the mean
      • setMeanImpl

        public void setMeanImpl(StorelessUnivariateStatistic meanImpl)                 throws MathIllegalStateException

        Sets the implementation for the mean.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        meanImpl - the StorelessUnivariateStatistic instance to use for computing the mean
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n > 0)
      • getVarianceImpl

        public StorelessUnivariateStatistic getVarianceImpl()
        Returns the currently configured variance implementation
        Returns:
        the StorelessUnivariateStatistic implementing the variance
      • setVarianceImpl

        public void setVarianceImpl(StorelessUnivariateStatistic varianceImpl)                     throws MathIllegalStateException

        Sets the implementation for the variance.

        This method cannot be activated after data has been added - i.e., after addValue has been used to add data. If it is activated after data has been added, an IllegalStateException will be thrown.

        Parameters:
        varianceImpl - the StorelessUnivariateStatistic instance to use for computing the variance
        Throws:
        MathIllegalStateException - if data has already been added (i.e if n > 0)
      • copy

        public SummaryStatistics copy()
        Returns a copy of this SummaryStatistics instance with the same internal state.
        Returns:
        a copy of this

SCaVis 2.0 © jWork.ORG