ProbabilityState
jhplot.stat

Class ProbabilityState



  • public class ProbabilityStateextends Object
    Calculates the probabilities of each state in a random variable. Provides the base for all functions of one variable. Additional functions include the normaliseArrays function which converts all inputs so they start at 0, and the mergeArrays function which creates an array of the joint state of the two input arrays.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ProbabilityState(double[] dataVector)
      Constructor for the ProbabilityState class.
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      static intmergeArrays(double[] firstVector, double[] secondVector, double[] outputVector)
      Takes in two arrays and writes the joint state of those arrays to the output vector, returning the maximum joint state.
      static intnormaliseArray(double[] inputVector, int[] outputVector)
      Takes an input vector and writes an output vector which is a normalised version of the input, and returns the maximum state.
      static voidprintDoubleVector(double[] vector)
      A helper function which prints out any given double vector.
      static voidprintIntVector(int[] vector)
      A helper function which prints out any given int vector.
    • Constructor Detail

      • ProbabilityState

        public ProbabilityState(double[] dataVector)
        Constructor for the ProbabilityState class. Takes a data vector and calculates the marginal probability of each state, storing each state/probability pair in a HashMap.
        Parameters:
        dataVector - Input vector. It is discretised to the floor of each value.
    • Method Detail

      • normaliseArray

        public static final int normaliseArray(double[] inputVector,                 int[] outputVector)
        Takes an input vector and writes an output vector which is a normalised version of the input, and returns the maximum state. A normalised array has min value = 0, max value = old max value - min value and all values are integers The length of the vectors must be the same, and outputVector must be instantiated before calling this function.
        Parameters:
        inputVector - The vector to normalise.
        outputVector - The normalised vector. Must be instantiated to length inputVector.length.
        Returns:
        The maximum state from the normalised vector.
      • mergeArrays

        public static final int mergeArrays(double[] firstVector,              double[] secondVector,              double[] outputVector)
        Takes in two arrays and writes the joint state of those arrays to the output vector, returning the maximum joint state. The length of all vectors must be equal to firstVector.length outputVector must be instantiated before calling this function.
        Parameters:
        firstVector - The first vector.
        secondVector - The second vector.
        outputVector - The merged vector. Must be instantiated to length inputVector.length.
        Returns:
        The maximum state from the merged vector.
      • printIntVector

        public static void printIntVector(int[] vector)
        A helper function which prints out any given int vector. Mainly used to help debug the rest of the toolbox.
        Parameters:
        vector - The vector to print out.
      • printDoubleVector

        public static void printDoubleVector(double[] vector)
        A helper function which prints out any given double vector. Mainly used to help debug the rest of the toolbox.
        Parameters:
        vector - The vector to print out.

SCaVis 1.8 © jWork.org