Class SampleSet
java.lang.Object
org.ojalgo.random.SampleSet
- All Implemented Interfaces:
Access1D<Double>, Structure1D
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSampleSet.CombineableSet<N extends Comparable<N>>Nested classes/interfaces inherited from interface Access1D
Access1D.Aggregatable<N>, Access1D.Collectable<N,R>, Access1D.ElementView<N>, Access1D.SelectionView<N>, Access1D.Sliceable<N>, Access1D.Visitable<N> Nested classes/interfaces inherited from interface Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S,B>, Structure1D.LongIndex, Structure1D.LoopCallback -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate Access1D<?> private double[]private doubleprivate double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidstatic doublecalculateVariance(double sumOfValues, double sumOfSquaredValues, int numberOfValues) longcount()The total number of elements in this structure.doubledoubleValue(int index) static <T> SampleSetCreate a sample set from counting occurrences of difference values in the iterable.get(long index) doublegetCorrelation(SampleSet other) doublegetCovariance(SampleSet other) doublegetFirst()doubledoublemax(abs(value))doublegetLast()doublemax(value)doublegetMean()doublePotentially expensive as it requires copying and sorting of the samples.doubleThe mean of the highest and lowest values.doublemin(value)doublehttps://en.wikipedia.org/wiki/Quartiledoublehttps://en.wikipedia.org/wiki/Quartiledoublehttps://en.wikipedia.org/wiki/QuartiledoublegetRange()The difference between the highest and lowest values.(package private) Access1D<?> doublemin(abs(value))(package private) double[]doubledoublegetStandardScore(int index) The standard score is the (signed) number of standard deviations an observation or datum is above the mean.doubleSum of squares is a concept that permeates much of inferential statistics and descriptive statistics.double[]doublestatic SampleSetmake()static SampleSetmake(RandomNumber randomNumber, int size) static Collector<Double, SampleSet.CombineableSet<Double>, SampleSet> static <N extends Comparable<N>>
Collector<N, SampleSet.CombineableSet<N>, SampleSet> newCollector(DenseArray.Factory<N, ?> factory) static SampleSet.CombineableSet<Double> static <N extends Comparable<N>>
SampleSet.CombineableSet<N> newCombineableSet(DenseArray.Factory<N, ?> factory) voidreset()If the underlyingAccess1Dof samples is modified you must reset the sample set before using.intsize()The total number of elements in this structure.swap(double... samples) Replace the underlying samples and reset the sample set.toString()static SampleSetwrap(double... samples) static SampleSetMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Access1D
asCollectable1D, asKeyed1D, asList, axpy, byteValue, byteValue, dot, doubleValue, elements, floatValue, floatValue, intValue, intValue, longValue, longValue, nonzeros, select, shortValue, shortValue, supplyTo, toList, toRawCopy1D
-
Field Details
-
myMax
private transient double myMax -
myMean
private transient double myMean -
myMin
private transient double myMin -
myQuartile1
private transient double myQuartile1 -
myQuartile2
private transient double myQuartile2 -
myQuartile3
private transient double myQuartile3 -
mySamples
-
mySortedCopy
private transient double[] mySortedCopy -
myStandardDeviation
private transient double myStandardDeviation -
myVariance
private transient double myVariance
-
-
Constructor Details
-
SampleSet
SampleSet(Access1D<?> samples)
-
-
Method Details
-
calculateVariance
public static double calculateVariance(double sumOfValues, double sumOfSquaredValues, int numberOfValues) - Parameters:
sumOfValues- The sum of all values in a sample setsumOfSquaredValues- The sum of all squared values, in a sample setnumberOfValues- The number of values in the sample set- Returns:
- The sample set's variance
-
from
-
make
-
make
-
newCollector
-
newCollector
public static <N extends Comparable<N>> Collector<N, SampleSet.CombineableSet<N>, SampleSet> newCollector(DenseArray.Factory<N, ?> factory) -
newCombineableSet
-
newCombineableSet
public static <N extends Comparable<N>> SampleSet.CombineableSet<N> newCombineableSet(DenseArray.Factory<N, ?> factory) -
wrap
-
wrap
-
count
public long count()Description copied from interface:Structure1DThe total number of elements in this structure.You only need to implement this method if the structure can contain more than Integer.MAX_VALUE elements.
- Specified by:
countin interfaceStructure1D
-
doubleValue
public double doubleValue(int index) - Specified by:
doubleValuein interfaceAccess1D<Double>
-
get
-
getCorrelation
-
getCovariance
-
getFirst
public double getFirst() -
getInterquartileRange
public double getInterquartileRange() -
getLargest
public double getLargest()max(abs(value)) -
getLast
public double getLast() -
getMaximum
public double getMaximum()max(value) -
getMean
public double getMean() -
getMedian
public double getMedian()Potentially expensive as it requires copying and sorting of the samples. -
getMidrange
public double getMidrange()The mean of the highest and lowest values. (Max + Min) / 2 -
getMinimum
public double getMinimum()min(value) -
getQuartile1
public double getQuartile1()https://en.wikipedia.org/wiki/QuartilePotentially expensive as it requires copying and sorting of the samples.
-
getQuartile2
public double getQuartile2()https://en.wikipedia.org/wiki/QuartilePotentially expensive as it requires copying and sorting of the samples.
-
getQuartile3
public double getQuartile3()https://en.wikipedia.org/wiki/QuartilePotentially expensive as it requires copying and sorting of the samples.
-
getRange
public double getRange()The difference between the highest and lowest values. Max - Min -
getSmallest
public double getSmallest()min(abs(value)) -
getStandardDeviation
public double getStandardDeviation() -
getStandardScore
public double getStandardScore(int index) The standard score is the (signed) number of standard deviations an observation or datum is above the mean. Thus, a positive standard score indicates a datum above the mean, while a negative standard score indicates a datum below the mean. It is a dimensionless quantity obtained by subtracting the population mean from an individual raw score and then dividing the difference by the population standard deviation.- See Also:
-
getSumOfSquares
public double getSumOfSquares()Sum of squares is a concept that permeates much of inferential statistics and descriptive statistics. More properly, it is "the sum of the squared deviations". Mathematically, it is an unscaled, or unadjusted measure of dispersion (also called variability). When scaled for the number of degrees of freedom, it estimates the variance, or spread of the observations about their mean value.- See Also:
-
getValues
public double[] getValues()- Returns:
- A copy of the internal data (the samples).
-
getVariance
public double getVariance() -
reset
public void reset()If the underlyingAccess1Dof samples is modified you must reset the sample set before using. -
size
public int size()Description copied from interface:Structure1DThe total number of elements in this structure.- Specified by:
sizein interfaceStructure1D
-
swap
-
swap
-
toString
-
calculateQuartiles
private void calculateQuartiles() -
getSamples
Access1D<?> getSamples() -
getSortedCopy
double[] getSortedCopy()
-