IntegerFrequency

class IntegerFrequency(data: IntArray? = null, name: String? = null, val lowerLimit: Int = Int.MIN_VALUE, val upperLimit: Int = Int.MAX_VALUE) : IdentityIfc, IntegerFrequencyIfc

This class tabulates the frequency associated with the integers presented to it via the collect() method Every value presented is interpreted as an integer For every value presented a count is maintained. There could be space/time performance issues if the number of different values presented is large. Use lowerLimit and upperLimit to limit the values that can be observed. Values lower than the lower limit are counted as underflow and values greater than the upper limit are counted as overflow.

This class can be useful for tabulating a discrete histogram over the values (integers) presented.

Author

rossetti

Parameters

lowerLimit

the defined lower limit of the integers, values less than this are not tabulated

upperLimit

the defined upper limit of the integers, values less than this are not tabulated

name

a name for the instance

data

an array of data to tabulate

Constructors

Link copied to clipboard
constructor(data: IntArray? = null, name: String? = null, intRange: IntRange = Int.MIN_VALUE..Int.MAX_VALUE)

This class tabulates the frequency associated with the integers presented to it via the collect() method Every value presented is interpreted as an integer For every value presented a count is maintained. There could be space/time performance issues if the number of different values presented is large. Use intRange to limit the values within the specified range that can be observed. Values lower than the lower limit are counted as underflow and values greater than the upper limit are counted as overflow.

constructor(data: IntArray? = null, name: String? = null, lowerLimit: Int = Int.MIN_VALUE, upperLimit: Int = Int.MAX_VALUE)

Types

Link copied to clipboard
inner class Cell(val value: Int) : Comparable<IntegerFrequency.Cell>

Holds the values and their counts

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The statistical average of the observed integers.

Link copied to clipboard
open override val closedRange: ClosedRange<Int>

Returns a closed range over the observed integer values

Link copied to clipboard
open override val frequencies: IntArray

Returns an array of size numberOfCells containing the frequencies for each value observed. The 0th element is the frequency for the value stored at element 0 of the array returned by the values property

Link copied to clipboard
open override val id: Int
Link copied to clipboard
open override var label: String?
Link copied to clipboard
open override val lowerLimit: Int
Link copied to clipboard
open override val max: Int

The largest integer observed

Link copied to clipboard
open override val min: Int

The smallest integer observed

Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val numberOfValues: Int

Returns the number of cells tabulated This is also the total number of different integers observed

Link copied to clipboard
open override var overFlowCount: Int

The number of observations that fell past the last bin's upper limit

Link copied to clipboard
open override val proportions: DoubleArray

Returns an array of size numberOfCells containing the proportion by value. The 0th element is the proportion for the value stored at element 0 of the array returned by the values property, etc.

Link copied to clipboard
open override val range: Int

The range of integer values observed (max - min)

Link copied to clipboard
open override val totalCount: Double

The total count associated with the values The total number of values observed

Link copied to clipboard
open override var underFlowCount: Int

The number of observations that fell below the first bin's lower limit

Link copied to clipboard
open override val upperLimit: Int
Link copied to clipboard

Returns Map holding the values and cumulative proportions as arrays with keys "values" and "cumulativeProportions"

Link copied to clipboard
open override val valueFrequencies: Map<String, IntArray>

Returns Map holding the values and frequencies as arrays with keys "values" and "frequencies"

Link copied to clipboard
open override val valueProportions: Map<String, DoubleArray>

Returns Map holding the values and proportions as arrays with keys "values" and "proportions"

Link copied to clipboard
open override val values: IntArray

Returns an array of size numberOfCells containing the observed values increasing by value. The 0th element of the array contains the smallest value observed, 1st element the next bigger value, etc.

Functions

Link copied to clipboard
open override fun assignCellLabels(labels: Map<Int, String>)

Assigns a string label to each observed integer value. If the integer values in the labels map is not one of the observed values then no assignment occurs and the default label is used. This should be done after collection because cells are created during the collection process.

Link copied to clipboard
open override fun cellList(): List<IntegerFrequency.Cell>

Returns a copy of the cells in a list ordered by the value of each cell, 0th element is cell with the smallest value (integer) observed, etc

Link copied to clipboard
open override fun cells(): List<IntegerFrequency.Cell>

Returns a sorted list containing the cells

Link copied to clipboard

Returns a copy of the cells in a list ordered by the count of each cell, 0th element is cell with the largest count, etc

Link copied to clipboard
fun collect(i: Double)
fun collect(array: DoubleArray)
fun collect(intArray: IntArray)

fun collect(i: Int)

Tabulates the count of the number of i's presented.

Link copied to clipboard
open override fun createDEmpiricalCDF(): DEmpiricalCDF
Link copied to clipboard
open override fun cumulativeFrequency(i: Int): Double

Returns the cumulative frequency up to an including i

Link copied to clipboard
open override fun cumulativeProportion(i: Int): Double

Returns the cumulative proportion up to an including i

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

Text output for the frequency without the summary statistics.

Link copied to clipboard
open override fun frequencies(x: IntArray): DoubleArray

Interprets the elements of x[] as values and returns an array representing the frequency for each value

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

Returns the current frequency for the provided integer

Link copied to clipboard
open override fun frequencyData(): List<FrequencyData>

Returns the data associated with the tabulation.

Link copied to clipboard
open override fun frequencyPlot(proportions: Boolean): IntegerFrequencyPlot

Creates a plot for the integer frequencies. The parameter, proportions indicates whether proportions (true) or frequencies (false) will be shown on the plot. The default is false.

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

Gets the proportion of the observations that are equal to the supplied integer

Link copied to clipboard
fun reset()

Resets the statistical collection

Link copied to clipboard
Link copied to clipboard

Converts the integer frequency data into a dataframe representation

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