Class StateFrequency

    • Constructor Detail

      • StateFrequency

        public StateFrequency​(int numStates)
        Parameters:
        numStates - the number of states to observe
    • Method Detail

      • getStates

        public final java.util.List<State> getStates()
        Returns:
        a copy of the list of states
      • getLastValue

        public final int getLastValue()
        Returns:
        the last state number observed
      • getLastState

        public final State getLastState()
        Returns:
        the last state observed
      • reset

        public void reset()
        Resets the statistical collection
      • collect

        public final void collect​(State[] states)
        Parameters:
        states - an array of states to collect on, must not be null
      • collect

        public final void collect​(java.util.List<State> states)
        Parameters:
        states - a list of states to collect on, must not be null
      • collect

        public void collect​(State state)
        Tabulate statistics on the state occurrences
        Parameters:
        state - if state is not one of the states created by this StateFrequency then it is not tabulated (i.e. it is ignored)
      • getTransitionCounts

        public final int[][] getTransitionCounts()
        Returns:
        an array of the count of state transitions from state i to state j
      • getTransitionProportions

        public final double[][] getTransitionProportions()
        Returns:
        an array of the proportion of state transitions from state i to state j
      • getValues

        public final int[] getValues()
        Returns an array of size getNumberOfCells() containing the values increasing by value
        Returns:
        the array of values observed or an empty array
      • getFrequencies

        public final int[] getFrequencies()
        Returns an array of size getNumberOfCells() containing the frequencies by value
        Returns:
        the array of frequencies observed or an empty array
      • getProportions

        public final double[] getProportions()
        Returns an array of size getNumberOfCells() containing the proportion by value
        Returns:
        the array of proportions observed or an empty array
      • getCumulativeFrequency

        public final int getCumulativeFrequency​(int i)
        Returns the cumulative frequency up to an including i
        Parameters:
        i - the integer for the desired frequency
        Returns:
        the cumulative frequency
      • getCumulativeProportion

        public final double getCumulativeProportion​(int i)
        Returns the cumulative proportion up to an including i
        Parameters:
        i - the integer for the desired proportion
        Returns:
        the cumulative proportion
      • getValueFrequencies

        public final int[][] getValueFrequencies()
        Returns a n by 2 array of value, frequency pairs where n = getNummberOfCells()
        Returns:
        the array or an empty array
      • getValueProportions

        public final double[][] getValueProportions()
        Returns a n by 2 array of value, proportion pairs where n = getNumberOfCells()
        Returns:
        the array or an empty array
      • getValueCumulativeProportions

        public final double[][] getValueCumulativeProportions()
        Returns a n by 2 array of value, cumulative proportion pairs where n = getNumberOfCells()
        Returns:
        the array or an empty array
      • getNumberOfCells

        public final int getNumberOfCells()
        Returns the number of cells tabulated
        Returns:
        the number of cells tabulated
      • getTotalCount

        public final int getTotalCount()
        The total count associated with the values
        Returns:
        total count associated with the values
      • getFrequency

        public final int getFrequency​(int x)
        Returns the current frequency for the provided integer
        Parameters:
        x - the provided integer
        Returns:
        the frequency
      • getProportion

        public final double getProportion​(int x)
        Gets the proportion of the observations that are equal to the supplied integer
        Parameters:
        x - the integer
        Returns:
        the proportion
      • getFrequencies

        public final int[] getFrequencies​(int[] x)
        Interprets the elements of x[] as values and returns an array representing the frequency for each value
        Parameters:
        x - the values for the frequencies
        Returns:
        the returned frequencies
      • getCellList

        public final java.util.List<IntegerFrequency.Cell> getCellList()
        Returns a copy of the cells in a list ordered by the value of each cell, 0th element is cell with smallest value, etc
        Returns:
        the list
      • createDEmpiricalCDF

        public final DEmpiricalCDF createDEmpiricalCDF()
        Returns:
        a DEmpirical based on the frequencies
      • getCells

        public final java.util.SortedSet<IntegerFrequency.Cell> getCells()
        Returns a sorted set containing the cells
        Returns:
        the sorted set of cells
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface GetNameIfc
        Returns:
        a string representing the name of the object
      • getId

        public final int getId()
        Specified by:
        getId in interface IdentityIfc
        Returns:
        an int representing the id of the object
      • setName

        public final void setName​(java.lang.String str)
        Sets the name
        Parameters:
        str - The name as a string.
      • getStatistics

        public final Statistic getStatistics()
        Returns:
        a Statistic over the observed integers mapped to the states
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation
      • asString

        public java.lang.String asString()
        Returns:
        a string representation