Class QuantitativeDataList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Double>, java.util.Collection<java.lang.Double>, java.util.List<java.lang.Double>, java.util.RandomAccess

    public class QuantitativeDataList
    extends java.util.ArrayList<java.lang.Double>
    A class for qualitative data lists containing doubles
    Author:
    Bhagat
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.Double element)  
      boolean add​(java.lang.Double e)  
      boolean addAll​(int index, java.util.Collection<? extends java.lang.Double> c)  
      boolean addAll​(java.util.Collection<? extends java.lang.Double> c)  
      QuantitativeDataList addNumber​(double x)
      adds a number to each number in the list
      double average()
      computes the average of all the data
      QuantitativeDataList clean()
      removes all the outliers
      QuantitativeDataList clone()
      creates another QualitativeDataList in a separate memory location
      QuantitativeDataList divide​(double x)
      divides a number to each number in the list
      double[] fivePointSummary()
      uses other methods to create a five point summary
      double inInterval​(double lowerBound, double upperBound)
      gives the proportion of values in the list in an interval
      double inInterval​(Interval interval)
      gives the proportion of values in the list in an interval
      double interQuartileRange()
      computes the interquartile range
      double iqr()
      computes the interquartile range
      boolean isOutlier​(double d)
      decides if the double is an outlier using the 1.5 x iqr rule
      QuantitativeDataList map​(Function<java.lang.Double,​java.lang.Double> function)
      maps a function onto each value in the list
      double mean()
      computes the mean of all the data
      double median()
      finds the median of the data set
      QuantitativeDataList multiply​(double x)
      multiplies a number to each number in the list
      java.util.ArrayList<java.lang.Double> outliers()
      finds all the outliers using the 1.5 x iqr rule
      double quartile1()
      finds the first quartile
      double quartile3()
      finds the third quartile
      double range()
      computes the range of the data
      double sampleStandardDeviation()
      computes the sample standard deviation of the data, which is assuming that the sample is a part of the population
      double sampleVariance()
      computes the sample variance of the data, which is assuming that the sample is a part of the population
      java.lang.Double set​(int index, java.lang.Double element)  
      void sort()
      sorts the list
      double standardDeviation()
      computes the standard deviation of all the data, which is assuming that the sample is the entire population
      QuantitativeDataList subtract​(double x)
      subtracts a number to each number in the list
      double sum()
      computes the sum of all the data
      Vector toVector()
      creates a Vector from the data in this list
      double variance()
      computes the variance of all the data, which is assuming that the sample is the entire population
      double z​(double x)
      finds the z score of a parameter x
      • Methods inherited from class java.util.ArrayList

        clear, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • QuantitativeDataList

        public QuantitativeDataList()
        creates an empty list
      • QuantitativeDataList

        public QuantitativeDataList​(double... data)
        initializes the list with certain values
        Parameters:
        data - the data to put into the list
      • QuantitativeDataList

        public QuantitativeDataList​(java.lang.Double... data)
        initializes the list with certain values
        Parameters:
        data - the data to put into the list
    • Method Detail

      • set

        public java.lang.Double set​(int index,
                                    java.lang.Double element)
        Specified by:
        set in interface java.util.List<java.lang.Double>
        Overrides:
        set in class java.util.ArrayList<java.lang.Double>
        See Also:
        ArrayList.set(int, java.lang.Object)
      • add

        public boolean add​(java.lang.Double e)
        Specified by:
        add in interface java.util.Collection<java.lang.Double>
        Specified by:
        add in interface java.util.List<java.lang.Double>
        Overrides:
        add in class java.util.ArrayList<java.lang.Double>
        See Also:
        ArrayList.add(java.lang.Object)
      • add

        public void add​(int index,
                        java.lang.Double element)
        Specified by:
        add in interface java.util.List<java.lang.Double>
        Overrides:
        add in class java.util.ArrayList<java.lang.Double>
        See Also:
        ArrayList.add(int, java.lang.Object)
      • addAll

        public boolean addAll​(java.util.Collection<? extends java.lang.Double> c)
        Specified by:
        addAll in interface java.util.Collection<java.lang.Double>
        Specified by:
        addAll in interface java.util.List<java.lang.Double>
        Overrides:
        addAll in class java.util.ArrayList<java.lang.Double>
        See Also:
        ArrayList.addAll(java.util.Collection)
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends java.lang.Double> c)
        Specified by:
        addAll in interface java.util.List<java.lang.Double>
        Overrides:
        addAll in class java.util.ArrayList<java.lang.Double>
        See Also:
        ArrayList.addAll(int, java.util.Collection)
      • sort

        public void sort()
        sorts the list
      • sum

        public double sum()
        computes the sum of all the data
        Returns:
        the sum
      • mean

        public double mean()
        computes the mean of all the data
        Returns:
        the mean
      • average

        public double average()
        computes the average of all the data
        Returns:
        the average
      • median

        public double median()
        finds the median of the data set
        Returns:
        the median
      • quartile1

        public double quartile1()
        finds the first quartile
        Returns:
        the first quartile
      • quartile3

        public double quartile3()
        finds the third quartile
        Returns:
        the third quartile
      • fivePointSummary

        public double[] fivePointSummary()
        uses other methods to create a five point summary
        Returns:
        the five data points
      • range

        public double range()
        computes the range of the data
        Returns:
        the range
      • iqr

        public double iqr()
        computes the interquartile range
        Returns:
        the interquartile range
      • interQuartileRange

        public double interQuartileRange()
        computes the interquartile range
        Returns:
        the interquartile range
      • outliers

        public java.util.ArrayList<java.lang.Double> outliers()
        finds all the outliers using the 1.5 x iqr rule
        Returns:
        an array list containing the outliers
      • isOutlier

        public boolean isOutlier​(double d)
        decides if the double is an outlier using the 1.5 x iqr rule
        Parameters:
        d - the double
        Returns:
        whether or not it is an outlier
      • map

        public QuantitativeDataList map​(Function<java.lang.Double,​java.lang.Double> function)
        maps a function onto each value in the list
        Parameters:
        function - the function
        Returns:
        a reference to this list
      • addNumber

        public QuantitativeDataList addNumber​(double x)
        adds a number to each number in the list
        Parameters:
        x - the number to add
        Returns:
        a reference to this list
      • subtract

        public QuantitativeDataList subtract​(double x)
        subtracts a number to each number in the list
        Parameters:
        x - the number to subtract
        Returns:
        a reference to this list
      • multiply

        public QuantitativeDataList multiply​(double x)
        multiplies a number to each number in the list
        Parameters:
        x - the number to multiply
        Returns:
        a reference to this list
      • divide

        public QuantitativeDataList divide​(double x)
        divides a number to each number in the list
        Parameters:
        x - the number to divide
        Returns:
        a reference to this list
      • z

        public double z​(double x)
        finds the z score of a parameter x
        Parameters:
        x - the parameter
        Returns:
        the z score
      • inInterval

        public double inInterval​(Interval interval)
        gives the proportion of values in the list in an interval
        Parameters:
        interval - the interval
        Returns:
        the proportion
      • inInterval

        public double inInterval​(double lowerBound,
                                 double upperBound)
        gives the proportion of values in the list in an interval
        Parameters:
        lowerBound - the lower bound of the interval
        upperBound - the upper bound of the interval
        Returns:
        the proportion
      • clean

        public QuantitativeDataList clean()
        removes all the outliers
        Returns:
        a reference to this list after cleaning it
      • clone

        public QuantitativeDataList clone()
        creates another QualitativeDataList in a separate memory location
        Overrides:
        clone in class java.util.ArrayList<java.lang.Double>
      • toVector

        public Vector toVector()
        creates a Vector from the data in this list
        Returns:
        the vector
      • variance

        public double variance()
        computes the variance of all the data, which is assuming that the sample is the entire population
        Returns:
        the variance
      • sampleVariance

        public double sampleVariance()
        computes the sample variance of the data, which is assuming that the sample is a part of the population
        Returns:
        the sample variance
      • standardDeviation

        public double standardDeviation()
        computes the standard deviation of all the data, which is assuming that the sample is the entire population
        Returns:
        the standard deviation
      • sampleStandardDeviation

        public double sampleStandardDeviation()
        computes the sample standard deviation of the data, which is assuming that the sample is a part of the population
        Returns:
        the sample standard deviation