Class Arguments
java.lang.Object
org.apache.commons.statistics.inference.Arguments
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidcheckCategoriesRequiredSize(int size, int required) Check the categories size is the minimum required,size >= required.(package private) static doublecheckFinite(double v) Check that the value is finite.(package private) static voidcheckNonNaN(double[] values) Check that all values are notDouble.NaN.(package private) static voidcheckNonNegative(double v) Check that the value is>= 0.(package private) static intcheckNonNegative(int v) Check that the value is>= 0.(package private) static voidcheckNonNegative(long[] values) Check that all values are>= 0.(package private) static voidcheckNonNegative(long[][] values) Check that all values are>= 0.(package private) static <E extends Enum<E>>
EcheckOption(E v, Set<E> allowed) Check the option is allowed.(package private) static voidcheckRectangular(long[][] array) Checks if the input array is rectangular.(package private) static voidcheckSignificance(double alpha) Check the significance level is in the correct range.(package private) static doublecheckStrictlyPositive(double v) Check that value is> 0.(package private) static voidcheckStrictlyPositive(double[] values) Check that all values are> 0.(package private) static intcheckStrictlyPositive(int v) Check that value is> 0.(package private) static voidcheckTable(int[][] table) Check the input is a 2-by-2 contingency table.(package private) static voidcheckValuesRequiredSize(int size, int required) Check the values size is the minimum required,size >= required.(package private) static voidcheckValuesSizeMatch(int size1, int size2) Check the values sizes are equal,size1 == size2.
-
Field Details
-
TWO
private static final int TWOTwo.- See Also:
-
-
Constructor Details
-
Arguments
private Arguments()No instances.
-
-
Method Details
-
checkSignificance
static void checkSignificance(double alpha) Check the significance level is in the correct range.- Parameters:
alpha- Significance level of the test.- Throws:
IllegalArgumentException- ifalphais not in the range(0, 0.5]
-
checkNonNegative
static int checkNonNegative(int v) Check that the value is>= 0.- Parameters:
v- Value to be tested.- Returns:
- the value
- Throws:
IllegalArgumentException- if the value is less than 0.
-
checkNonNegative
static void checkNonNegative(double v) Check that the value is>= 0.- Parameters:
v- Value to be tested.- Throws:
IllegalArgumentException- if the value is less than 0.
-
checkNonNegative
static void checkNonNegative(long[] values) Check that all values are>= 0.- Parameters:
values- Values to be tested.- Throws:
IllegalArgumentException- if any values are less than 0.
-
checkNonNegative
static void checkNonNegative(long[][] values) Check that all values are>= 0.- Parameters:
values- Values to be tested.- Throws:
IllegalArgumentException- if any values are less than 0.
-
checkStrictlyPositive
static int checkStrictlyPositive(int v) Check that value is> 0.- Parameters:
v- Value to be tested.- Returns:
- the value
- Throws:
IllegalArgumentException- if the value is not strictly positive.
-
checkStrictlyPositive
static double checkStrictlyPositive(double v) Check that value is> 0.- Parameters:
v- Value to be tested.- Returns:
- the value
- Throws:
IllegalArgumentException- if the value is not strictly positive.
-
checkStrictlyPositive
static void checkStrictlyPositive(double[] values) Check that all values are> 0.- Parameters:
values- Values to be tested.- Throws:
IllegalArgumentException- if any values are not strictly positive.
-
checkFinite
static double checkFinite(double v) Check that the value is finite.- Parameters:
v- Value to be tested.- Returns:
- the value
- Throws:
IllegalArgumentException- if the value is not finite.
-
checkNonNaN
static void checkNonNaN(double[] values) Check that all values are notDouble.NaN.- Parameters:
values- Values to be tested.- Throws:
IllegalArgumentException- if any values are NaN.
-
checkRectangular
static void checkRectangular(long[][] array) Checks if the input array is rectangular. It is assumed the array is non-null and has a non-zero length.- Parameters:
array- Array to be tested.- Throws:
NullPointerException- if input array is nullIndexOutOfBoundsException- if input array is zero lengthIllegalArgumentException- if input array is not rectangular
-
checkValuesRequiredSize
static void checkValuesRequiredSize(int size, int required) Check the values size is the minimum required,size >= required.- Parameters:
size- Values size.required- Required size.- Throws:
IllegalArgumentException- ifsize < required
-
checkCategoriesRequiredSize
static void checkCategoriesRequiredSize(int size, int required) Check the categories size is the minimum required,size >= required.- Parameters:
size- Values size.required- Required size.- Throws:
IllegalArgumentException- ifsize < required
-
checkValuesSizeMatch
static void checkValuesSizeMatch(int size1, int size2) Check the values sizes are equal,size1 == size2.- Parameters:
size1- First size.size2- Second size.- Throws:
IllegalArgumentException- ifsize1 != size2
-
checkOption
Check the option is allowed.- Type Parameters:
E- Option type.- Parameters:
v- Option value.allowed- Allowed options.- Returns:
- the value
- Throws:
IllegalArgumentException- if the value is not in the allowed options or is null
-
checkTable
static void checkTable(int[][] table) Check the input is a 2-by-2 contingency table.- Parameters:
table- Table.- Throws:
IllegalArgumentException- if thetableis not a 2-by-2 table; any table entry is negative; or the sum is zero or is not an integer
-