Histogram

class Histogram @JvmOverloads constructor(breakPoints: DoubleArray, name: String? = null) : AbstractStatistic, HistogramIfc(source)

A Histogram tabulates data into bins. The user must specify the break points of the bins, b0, b1, b2, ..., bk, where there are k+1 break points, and k bins. b0 may be Double.NEGATIVE_INFINITY and bk may be Double.POSITIVE_INFINITY.

If only one break point is supplied, then the bins are automatically defined as: (Double.NEGATIVE_INFINITY, b0] and (b0, Double.POSITIVE_INFINITY).

If two break points are provided, then there is one bin: [b0, b1), any values less than b0 will be counted as underflow and any values [b1, +infinity) will be counted as overflow.

If k+1 break points are provided then the bins are defined as: [b0,b1), [b1,b2), [b2,b3), ..., [bk-1,bk) and any values in (-infinity, b0) will be counted as underflow and any values [bk, +infinity) will be counted as overflow. If b0 equals Double.NEGATIVE_INFINITY then there can be no underflow. Similarly, if bk equals Double.POSITIVE_INFINITY there can be no overflow.

The break points do not have to define equally sized bins. Static methods within companion object are provided to create equal width bins and to create histograms with common characteristics.

If any presented value is Double.NaN, then the value is counted as missing and the observation is not tallied towards the total number of observations. Underflow and overflow counts also do not count towards the total number of observations.

Statistics are also automatically collected on the collected observations. The statistics do not include missing, underflow, and overflow observations. Statistics are only computed on those observations that were placed (counted) within some bin.

Parameters

breakPoints

the break points for the histogram and must be strictly increasing

name

an optional name for the histogram

Constructors

Link copied to clipboard
constructor(breakPoints: DoubleArray, name: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val average: Double

Gets the unweighted average of the observations.

Link copied to clipboard
open override val binArray: Array<HistogramBin>

Returns an array of Bins based on the current state of the histogram

Link copied to clipboard
open override val binCounts: DoubleArray
Link copied to clipboard
open override val bins: List<HistogramBin>

Returns a List of Bins based on the current state of the histogram

Link copied to clipboard
open override val breakPoints: DoubleArray
Link copied to clipboard
open override val count: Double

Gets the count for the number of the observations.

Link copied to clipboard
open override val deviationSumOfSquares: Double

Gets the sum of squares of the deviations from the average This is the numerator in the classic sample variance formula

Link copied to clipboard
open override val firstBinLowerLimit: Double

Lower limit of first histogram bin.

Link copied to clipboard
open override val kurtosis: Double

Gets the kurtosis of the data

Link copied to clipboard
open override val lag1Correlation: Double

Gets the lag-1 generate correlation of the unweighted observations. Note: See Box, Jenkins, Reinsel, Time Series Analysis, 3rd edition, Prentice-Hall, pg 31

Link copied to clipboard
open override val lag1Covariance: Double

Gets the lag-1 generate covariance of the unweighted observations. Note: See Box, Jenkins, Reinsel, Time Series Analysis, 3rd edition, Prentice-Hall, pg 31

Link copied to clipboard
open override val lastBinUpperLimit: Double

Upper limit of the last histogram bin.

Link copied to clipboard
open override val max: Double

Gets the maximum of the observations.

Link copied to clipboard
open override val min: Double

Gets the minimum of the observations.

Link copied to clipboard
open override val negativeCount: Double

Counts the number of observations that were negative, strictly less than zero.

Link copied to clipboard
open override val numberBins: Int
Link copied to clipboard
open override var overFlowCount: Double

Counts of values located above the last bin.

Link copied to clipboard
open override val skewness: Double

Gets the skewness of the data

Link copied to clipboard
open override val standardError: Double

Gets the standard error of the observations. Simply the generate standard deviation divided by the square root of the number of observations

Link copied to clipboard
open override val sum: Double

Gets the sum of the observations.

Link copied to clipboard
open override val totalCount: Double

Total number of observations collected including overflow and underflow

Link copied to clipboard
open override var underFlowCount: Double

Counts of values located below the first bin.

Link copied to clipboard
open override val variance: Double

Gets the sample variance of the observations.

Link copied to clipboard

Gets the Von Neumann Lag 1 test statistic for checking the hypothesis that the data are uncorrelated Note: See Handbook of Simulation, Jerry Banks editor, McGraw-Hill, pg 253.

Link copied to clipboard
open override val zeroCount: Double

Counts the number of observations that were exactly zero.

Functions

Link copied to clipboard
open override fun bin(x: Double): HistogramBin

The bin that x falls in. The bin is a copy. It will not reflect observations collected after this call.

open override fun bin(binNum: Int): HistogramBin

Returns an instance of a Bin for the supplied bin number The bin does not reflect changes to the histogram after this call. May throw IndexOutOfBoundsException

Link copied to clipboard
open override fun binCount(x: Double): Double

Returns the current bin count for the bin associated with x

open override fun binCount(binNum: Int): Double

Returns the bin count for the indicated bin

Link copied to clipboard
open override fun binFraction(x: Double): Double

Returns the fraction of the data relative to those tabulated in the bins for the bin number associated with the x

open override fun binFraction(binNum: Int): Double

Returns the fraction of the data relative to those tabulated in the bins for the supplied bin number

Link copied to clipboard
open override fun binNumber(x: Double): Int

Bins are numbered starting at 1 through the number of bins

Link copied to clipboard
open override fun collect(obs: Double)

Collect on the supplied value. Double.NaN, Double.NEGATIVE_INFINITY, and Double.POSITIVE_INFINITY values are counted as missing. Null values are not permitted.

Link copied to clipboard
open override fun copyOfAsStatistic(): Statistic

Return a copy of the information as an instance of a statistic

Link copied to clipboard
open override fun cumulativeBinCount(x: Double): Double

Returns the cumulative count of all bins up to and including the bin containing the value x

open override fun cumulativeBinCount(binNum: Int): Double

Returns the cumulative count of all the bins up to and including the indicated bin number

Link copied to clipboard
open override fun cumulativeBinFraction(x: Double): Double

Returns the cumulative fraction of the data up to and including the bin containing the value of x

open override fun cumulativeBinFraction(binNum: Int): Double

Returns the cumulative fraction of the data up to and including the indicated bin number

Link copied to clipboard
open override fun cumulativeCount(x: Double): Double

Returns the cumulative count of all the data (including underflow and overflow) for all bins up to and including the bin containing x

open override fun cumulativeCount(binNum: Int): Double

Returns the cumulative count of all the data (including underflow and overflow) up to and including the indicated bin

Link copied to clipboard
open override fun cumulativeFraction(x: Double): Double

Returns the cumulative fraction of all the data up to an including the bin containing the value x, (includes over and under flow)

open override fun cumulativeFraction(binNum: Int): Double

Returns the cumulative fraction of all the data up to and including the supplied bin (includes over and under flow)

Link copied to clipboard
open override fun findBin(x: Double): HistogramBin
Link copied to clipboard
open override fun halfWidth(level: Double): Double

Gets the confidence interval half-width. Simply the standard error times the confidence coefficient as determined by an appropriate sampling distribution

Link copied to clipboard
open override fun leadingDigitRule(multiplier: Double): Int

Computes the right most meaningful digit according to (int)Math.floor(Math.log10(a*getStandardError())) See doi 10.1287.opre.1080.0529 by Song and Schmeiser

Link copied to clipboard
open override fun reset()

Resets the collector as if no observations had been collected.

Link copied to clipboard
open override fun toString(): String

Returns a String representation of the Statistic