Package org.ojalgo.random
Class SampleSet
java.lang.Object
org.ojalgo.random.SampleSet
- All Implemented Interfaces:
Access1D<Double>
,Structure1D
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
SampleSet.CombineableSet<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.structure.Access1D
Access1D.Aggregatable<N extends Comparable<N>>, Access1D.Collectable<N extends Comparable<N>,
R extends Mutate1D>, Access1D.ElementView<N extends Comparable<N>>, Access1D.SelectionView<N extends Comparable<N>>, Access1D.Sliceable<N extends Comparable<N>>, Access1D.Visitable<N extends Comparable<N>> Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,
B extends Structure1D.Logical<S, B>>, Structure1D.LongIndex, Structure1D.LoopCallback -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
private double
private double
private double
private double
private double
private Access1D
<?> private double[]
private double
private double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
static double
calculateVariance
(double sumOfValues, double sumOfSquaredValues, int numberOfValues) long
count()
The total number of elements in this structure.double
doubleValue
(int index) static <T> SampleSet
Create a sample set from counting occurrences of difference values in the iterable.get
(long index) double
getCorrelation
(SampleSet other) double
getCovariance
(SampleSet other) double
getFirst()
double
double
max(abs(value))double
getLast()
double
max(value)double
getMean()
double
Potentially expensive as it requires copying and sorting of the samples.double
The mean of the highest and lowest values.double
min(value)double
https://en.wikipedia.org/wiki/Quartiledouble
https://en.wikipedia.org/wiki/Quartiledouble
https://en.wikipedia.org/wiki/Quartiledouble
getRange()
The difference between the highest and lowest values.(package private) Access1D
<?> double
min(abs(value))(package private) double[]
double
double
getStandardScore
(int index) The standard score is the (signed) number of standard deviations an observation or datum is above the mean.double
Sum of squares is a concept that permeates much of inferential statistics and descriptive statistics.double[]
double
static SampleSet
make()
static SampleSet
make
(RandomNumber randomNumber, int size) 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) void
reset()
If the underlyingAccess1D
of samples is modified you must reset the sample set before using.int
size()
The total number of elements in this structure.swap
(double... samples) Replace the underlying samples and reset the sample set.toString()
static SampleSet
wrap
(double... samples) static SampleSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ojalgo.structure.Access1D
asCollectable1D, asKeyed1D, axpy, byteValue, byteValue, dot, doubleValue, elements, floatValue, floatValue, intValue, intValue, longValue, longValue, nonzeros, select, shortValue, shortValue, supplyTo, 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
Create a sample set from counting occurrences of difference values in the iterable. -
make
-
make
-
newCollector
-
newCollector
public static <N extends Comparable<N>> Collector<N,SampleSet.CombineableSet<N>, newCollectorSampleSet> (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:Structure1D
The 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:
count
in interfaceStructure1D
-
doubleValue
public double doubleValue(int index) - Specified by:
doubleValue
in 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 underlyingAccess1D
of samples is modified you must reset the sample set before using. -
size
public int size()Description copied from interface:Structure1D
The total number of elements in this structure.- Specified by:
size
in interfaceStructure1D
-
swap
Replace the underlying samples and reset the sample set. -
swap
-
toString
-
calculateQuartiles
private void calculateQuartiles() -
getSamples
Access1D<?> getSamples() -
getSortedCopy
double[] getSortedCopy()
-