Package io.bhagat.math.statistics
Class QuantitativeDataList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<java.lang.Double>
-
- io.bhagat.math.statistics.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 longserialVersionUID
-
Constructor Summary
Constructors Constructor Description QuantitativeDataList()creates an empty listQuantitativeDataList(double... data)initializes the list with certain valuesQuantitativeDataList(java.lang.Double... data)initializes the list with certain values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Double element)booleanadd(java.lang.Double e)booleanaddAll(int index, java.util.Collection<? extends java.lang.Double> c)booleanaddAll(java.util.Collection<? extends java.lang.Double> c)QuantitativeDataListaddNumber(double x)adds a number to each number in the listdoubleaverage()computes the average of all the dataQuantitativeDataListclean()removes all the outliersQuantitativeDataListclone()creates another QualitativeDataList in a separate memory locationQuantitativeDataListdivide(double x)divides a number to each number in the listdouble[]fivePointSummary()uses other methods to create a five point summarydoubleinInterval(double lowerBound, double upperBound)gives the proportion of values in the list in an intervaldoubleinInterval(Interval interval)gives the proportion of values in the list in an intervaldoubleinterQuartileRange()computes the interquartile rangedoubleiqr()computes the interquartile rangebooleanisOutlier(double d)decides if the double is an outlier using the 1.5 x iqr ruleQuantitativeDataListmap(Function<java.lang.Double,java.lang.Double> function)maps a function onto each value in the listdoublemean()computes the mean of all the datadoublemedian()finds the median of the data setQuantitativeDataListmultiply(double x)multiplies a number to each number in the listjava.util.ArrayList<java.lang.Double>outliers()finds all the outliers using the 1.5 x iqr ruledoublequartile1()finds the first quartiledoublequartile3()finds the third quartiledoublerange()computes the range of the datadoublesampleStandardDeviation()computes the sample standard deviation of the data, which is assuming that the sample is a part of the populationdoublesampleVariance()computes the sample variance of the data, which is assuming that the sample is a part of the populationjava.lang.Doubleset(int index, java.lang.Double element)voidsort()sorts the listdoublestandardDeviation()computes the standard deviation of all the data, which is assuming that the sample is the entire populationQuantitativeDataListsubtract(double x)subtracts a number to each number in the listdoublesum()computes the sum of all the dataVectortoVector()creates a Vector from the data in this listdoublevariance()computes the variance of all the data, which is assuming that the sample is the entire populationdoublez(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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
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:
setin interfacejava.util.List<java.lang.Double>- Overrides:
setin classjava.util.ArrayList<java.lang.Double>- See Also:
ArrayList.set(int, java.lang.Object)
-
add
public boolean add(java.lang.Double e)
- Specified by:
addin interfacejava.util.Collection<java.lang.Double>- Specified by:
addin interfacejava.util.List<java.lang.Double>- Overrides:
addin classjava.util.ArrayList<java.lang.Double>- See Also:
ArrayList.add(java.lang.Object)
-
add
public void add(int index, java.lang.Double element)- Specified by:
addin interfacejava.util.List<java.lang.Double>- Overrides:
addin classjava.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:
addAllin interfacejava.util.Collection<java.lang.Double>- Specified by:
addAllin interfacejava.util.List<java.lang.Double>- Overrides:
addAllin classjava.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:
addAllin interfacejava.util.List<java.lang.Double>- Overrides:
addAllin classjava.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 intervalupperBound- 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:
clonein classjava.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
-
-