Class Statistics
java.lang.Object
org.apache.commons.statistics.descriptive.Statistics
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final DoubleConsumerA no-operation double consumer.private static final StringError message for an incompatible statistics.(package private) static final IntConsumerA no-operation int consumer.(package private) static final LongConsumerA no-operation long consumer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <T extends DoubleConsumer>
Tadd(T statistic, double[] values) Add all thevaluesto thestatistic.(package private) static <T extends DoubleConsumer>
Tadd(T statistic, int[] values) Add all thevaluesto thestatistic.(package private) static <T extends IntConsumer>
Tadd(T statistic, int[] values) Add all thevaluesto thestatistic.(package private) static <T extends DoubleConsumer>
Tadd(T statistic, long[] values) Add all thevaluesto thestatistic.(package private) static <T extends LongConsumer>
Tadd(T statistic, long[] values) Add all thevaluesto thestatistic.(package private) static voidCheck left-hand side argumentaisnullor else the right-hand side argumentbmust be run-time assignable to the same class asaso the statistics can be combined.(package private) static <T extends StatisticResult & StatisticAccumulator<T>>
voidcheckCombineCompatible(T a, T b) Check left-hand side argumentaisnullor else the right-hand side argumentbmust also be non-nullso the statistics can be combined.(package private) static <T extends StatisticResult & StatisticAccumulator<T>>
voidcombine(T a, T b) If the left-hand side argumentais non-null, combine it with the right-hand side argumentb.(package private) static voidIf the left-hand side argumentais non-null, combine it with the right-hand side argumentb.(package private) static DoubleConsumercompose(DoubleConsumer... consumers) Chain theconsumersinto a single composite consumer.(package private) static IntConsumercompose(IntConsumer... consumers) Chain theconsumersinto a single composite consumer.(package private) static LongConsumercompose(LongConsumer... consumers) Chain theconsumersinto a single composite consumer.(package private) static StatisticResultGets the statistic result using theBigIntegervalue.(package private) static StatisticResultGets the statistic result using thedoublevalue.(package private) static StatisticResultGets the statistic result using theintvalue.(package private) static StatisticResultGets the statistic result using thelongvalue.(package private) static booleanzeroVariance(double m1, double m2) Returnstrueif the second central momentm2is effectively zero given the magnitude of the first raw momentm1.
-
Field Details
-
DOUBLE_NOOP
A no-operation double consumer. This is exposed for testing. -
INT_NOOP
A no-operation int consumer. This is exposed for testing. -
LONG_NOOP
A no-operation long consumer. This is exposed for testing. -
INCOMPATIBLE_STATISTICS
Error message for an incompatible statistics.- See Also:
-
-
Constructor Details
-
Statistics
private Statistics()No instances.
-
-
Method Details
-
add
Add all thevaluesto thestatistic.- Type Parameters:
T- Type of the statistic- Parameters:
statistic- Statistic.values- Values.- Returns:
- the statistic
-
add
Add all thevaluesto thestatistic.- Type Parameters:
T- Type of the statistic- Parameters:
statistic- Statistic.values- Values.- Returns:
- the statistic
-
add
Add all thevaluesto thestatistic.- Type Parameters:
T- Type of the statistic- Parameters:
statistic- Statistic.values- Values.- Returns:
- the statistic
-
add
Add all thevaluesto thestatistic.- Type Parameters:
T- Type of the statistic- Parameters:
statistic- Statistic.values- Values.- Returns:
- the statistic
-
add
Add all thevaluesto thestatistic.- Type Parameters:
T- Type of the statistic- Parameters:
statistic- Statistic.values- Values.- Returns:
- the statistic
-
zeroVariance
static boolean zeroVariance(double m1, double m2) Returnstrueif the second central momentm2is effectively zero given the magnitude of the first raw momentm1.This method shares the logic for detecting a zero variance among implementations that divide by the variance (e.g. skewness, kurtosis).
- Parameters:
m1- First raw moment (mean).m2- Second central moment (biased variance).- Returns:
- true if the variance is zero
-
compose
Chain theconsumersinto a single composite consumer. Ignore anynullconsumer. Returnsnullif all arguments arenull.- Parameters:
consumers- Consumers.- Returns:
- a composed consumer (or null)
-
compose
Chain theconsumersinto a single composite consumer. Ignore anynullconsumer. Returnsnullif all arguments arenull.- Parameters:
consumers- Consumers.- Returns:
- a composed consumer (or null)
-
compose
Chain theconsumersinto a single composite consumer. Ignore anynullconsumer. Returnsnullif all arguments arenull.- Parameters:
consumers- Consumers.- Returns:
- a composed consumer (or null)
-
getResultAsIntOrNull
Gets the statistic result using theintvalue. Returnnullis the statistic isnull.- Parameters:
s- Statistic.- Returns:
- the result or null
-
getResultAsLongOrNull
Gets the statistic result using thelongvalue. Returnnullis the statistic isnull.- Parameters:
s- Statistic.- Returns:
- the result or null
-
getResultAsDoubleOrNull
Gets the statistic result using thedoublevalue. Returnnullis the statistic isnull.- Parameters:
s- Statistic.- Returns:
- the result or null
-
getResultAsBigIntegerOrNull
Gets the statistic result using theBigIntegervalue. Returnnullis the statistic isnull.- Parameters:
s- Statistic.- Returns:
- the result or null
-
checkCombineCompatible
Check left-hand side argumentaisnullor else the right-hand side argumentbmust also be non-nullso the statistics can be combined.- Type Parameters:
T-StatisticResultbeing accumulated.- Parameters:
a- LHS.b- RHS.- Throws:
IllegalArgumentException- if the objects cannot be combined
-
checkCombineAssignable
Check left-hand side argumentaisnullor else the right-hand side argumentbmust be run-time assignable to the same class asaso the statistics can be combined.- Parameters:
a- LHS.b- RHS.- Throws:
IllegalArgumentException- if the objects cannot be combined
-
combine
If the left-hand side argumentais non-null, combine it with the right-hand side argumentb.- Type Parameters:
T-StatisticResultbeing accumulated.- Parameters:
a- LHS.b- RHS.
-
combineMoment
If the left-hand side argumentais non-null, combine it with the right-hand side argumentb. Assumes that the RHS is run-time assignable to the same class as LHS.- Parameters:
a- LHS.b- RHS.- See Also:
-