本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL属性的具体用法?Java LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL怎么用?Java LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gTest
/**
* Performs a G-Test (Log-Likelihood Ratio Test) for goodness of fit
* evaluating the null hypothesis that the observed counts conform to the
* frequency distribution described by the expected counts, with
* significance level {@code alpha}. Returns true iff the null
* hypothesis can be rejected with {@code 100 * (1 - alpha)} percent confidence.
*
* <p><strong>Example:</strong><br> To test the hypothesis that
* {@code observed} follows {@code expected} at the 99% level,
* use </p><p>
* {@code gTest(expected, observed, 0.01)}</p>
*
* <p>Returns true iff {@link #gTest(double[], long[])
* gTestGoodnessOfFitPValue(expected, observed)} < alpha</p>
*
* <p><strong>Preconditions</strong>: <ul>
* <li>Expected counts must all be positive. </li>
* <li>Observed counts must all be ≥ 0. </li>
* <li>The observed and expected arrays must have the same length and their
* common length must be at least 2.
* <li> {@code 0 < alpha < 0.5} </li></ul></p>
*
* <p>If any of the preconditions are not met, a
* {@code MathIllegalArgumentException} is thrown.</p>
*
* <p><strong>Note:</strong>This implementation rescales the
* {@code expected} array if necessary to ensure that the sum of the
* expected and observed counts are equal.</p>
*
* @param observed array of observed frequency counts
* @param expected array of expected frequency counts
* @param alpha significance level of the test
* @return true iff null hypothesis can be rejected with confidence 1 -
* alpha
* @throws NotPositiveException if {@code observed} has negative entries
* @throws NotStrictlyPositiveException if {@code expected} has entries that
* are not strictly positive
* @throws DimensionMismatchException if the array lengths do not match or
* are less than 2.
* @throws MaxCountExceededException if an error occurs computing the
* p-value.
* @throws OutOfRangeException if alpha is not strictly greater than zero
* and less than or equal to 0.5
*/
public boolean gTest(final double[] expected, final long[] observed,
final double alpha)
throws NotPositiveException, NotStrictlyPositiveException,
DimensionMismatchException, OutOfRangeException, MaxCountExceededException {
if ((alpha <= 0) || (alpha > 0.5)) {
throw new OutOfRangeException(LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL,
alpha, 0, 0.5);
}
return gTest(expected, observed) < alpha;
}
示例2: gTestDataSetsComparison
/**
* <p>Performs a G-Test (Log-Likelihood Ratio Test) comparing two binned
* data sets. The test evaluates the null hypothesis that the two lists
* of observed counts conform to the same frequency distribution, with
* significance level {@code alpha}. Returns true iff the null
* hypothesis can be rejected with 100 * (1 - alpha) percent confidence.
* </p>
* <p>See {@link #gDataSetsComparison(long[], long[])} for details
* on the formula used to compute the G (LLR) statistic used in the test and
* {@link #gTest(double[], long[])} for information on how
* the observed significance level is computed. The degrees of of freedom used
* to perform the test is one less than the common length of the input observed
* count arrays. </p>
*
* <strong>Preconditions</strong>: <ul>
* <li>Observed counts must be non-negative. </li>
* <li>Observed counts for a specific bin must not both be zero. </li>
* <li>Observed counts for a specific sample must not all be 0. </li>
* <li>The arrays {@code observed1} and {@code observed2} must
* have the same length and their common length must be at least 2. </li>
* <li>{@code 0 < alpha < 0.5} </li></ul></p>
*
* <p>If any of the preconditions are not met, a
* {@code MathIllegalArgumentException} is thrown.</p>
*
* @param observed1 array of observed frequency counts of the first data set
* @param observed2 array of observed frequency counts of the second data
* set
* @param alpha significance level of the test
* @return true iff null hypothesis can be rejected with confidence 1 -
* alpha
* @throws DimensionMismatchException the the length of the arrays does not
* match
* @throws NotPositiveException if any of the entries in {@code observed1} or
* {@code observed2} are negative
* @throws ZeroException if either all counts of {@code observed1} or
* {@code observed2} are zero, or if the count at some index is
* zero for both arrays
* @throws OutOfRangeException if {@code alpha} is not in the range
* (0, 0.5]
* @throws MaxCountExceededException if an error occurs performing the test
*/
public boolean gTestDataSetsComparison(
final long[] observed1,
final long[] observed2,
final double alpha)
throws DimensionMismatchException, NotPositiveException,
ZeroException, OutOfRangeException, MaxCountExceededException {
if (alpha <= 0 || alpha > 0.5) {
throw new OutOfRangeException(
LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL, alpha, 0, 0.5);
}
return gTestDataSetsComparison(observed1, observed2) < alpha;
}
示例3: chiSquareTest
/**
* Performs a <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm">
* Chi-square goodness of fit test</a> evaluating the null hypothesis that the
* observed counts conform to the frequency distribution described by the expected
* counts, with significance level <code>alpha</code>. Returns true iff the null
* hypothesis can be rejected with 100 * (1 - alpha) percent confidence.
* <p>
* <strong>Example:</strong><br>
* To test the hypothesis that <code>observed</code> follows
* <code>expected</code> at the 99% level, use </p><p>
* <code>chiSquareTest(expected, observed, 0.01) </code></p>
* <p>
* <strong>Preconditions</strong>: <ul>
* <li>Expected counts must all be positive.
* </li>
* <li>Observed counts must all be ≥ 0.
* </li>
* <li>The observed and expected arrays must have the same length and
* their common length must be at least 2.
* <li> <code> 0 < alpha < 0.5 </code>
* </li></ul></p><p>
* If any of the preconditions are not met, an
* <code>IllegalArgumentException</code> is thrown.</p>
* <p><strong>Note: </strong>This implementation rescales the
* <code>expected</code> array if necessary to ensure that the sum of the
* expected and observed counts are equal.</p>
*
* @param observed array of observed frequency counts
* @param expected array of expected frequency counts
* @param alpha significance level of the test
* @return true iff null hypothesis can be rejected with confidence
* 1 - alpha
* @throws NotPositiveException if <code>observed</code> has negative entries
* @throws NotStrictlyPositiveException if <code>expected</code> has entries that are
* not strictly positive
* @throws DimensionMismatchException if the arrays length is less than 2
* @throws OutOfRangeException if <code>alpha</code> is not in the range (0, 0.5]
* @throws MaxCountExceededException if an error occurs computing the p-value
*/
public boolean chiSquareTest(final double[] expected, final long[] observed,
final double alpha)
throws NotPositiveException, NotStrictlyPositiveException,
DimensionMismatchException, OutOfRangeException, MaxCountExceededException {
if ((alpha <= 0) || (alpha > 0.5)) {
throw new OutOfRangeException(LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL,
alpha, 0, 0.5);
}
return chiSquareTest(expected, observed) < alpha;
}
示例4: chiSquareTestDataSetsComparison
/**
* <p>Performs a Chi-Square two sample test comparing two binned data
* sets. The test evaluates the null hypothesis that the two lists of
* observed counts conform to the same frequency distribution, with
* significance level <code>alpha</code>. Returns true iff the null
* hypothesis can be rejected with 100 * (1 - alpha) percent confidence.
* </p>
* <p>See {@link #chiSquareDataSetsComparison(long[], long[])} for
* details on the formula used to compute the Chisquare statistic used
* in the test. The degrees of of freedom used to perform the test is
* one less than the common length of the input observed count arrays.
* </p>
* <strong>Preconditions</strong>: <ul>
* <li>Observed counts must be non-negative.
* </li>
* <li>Observed counts for a specific bin must not both be zero.
* </li>
* <li>Observed counts for a specific sample must not all be 0.
* </li>
* <li>The arrays <code>observed1</code> and <code>observed2</code> must
* have the same length and their common length must be at least 2.
* </li>
* <li> <code> 0 < alpha < 0.5 </code>
* </li></ul><p>
* If any of the preconditions are not met, an
* <code>IllegalArgumentException</code> is thrown.</p>
*
* @param observed1 array of observed frequency counts of the first data set
* @param observed2 array of observed frequency counts of the second data set
* @param alpha significance level of the test
* @return true iff null hypothesis can be rejected with confidence
* 1 - alpha
* @throws DimensionMismatchException the the length of the arrays does not match
* @throws NotPositiveException if any entries in <code>observed1</code> or
* <code>observed2</code> are negative
* @throws ZeroException if either all counts of <code>observed1</code> or
* <code>observed2</code> are zero, or if the count at the same index is zero
* for both arrays
* @throws OutOfRangeException if <code>alpha</code> is not in the range (0, 0.5]
* @throws MaxCountExceededException if an error occurs performing the test
* @since 1.2
*/
public boolean chiSquareTestDataSetsComparison(final long[] observed1,
final long[] observed2,
final double alpha)
throws DimensionMismatchException, NotPositiveException,
ZeroException, OutOfRangeException, MaxCountExceededException {
if (alpha <= 0 ||
alpha > 0.5) {
throw new OutOfRangeException(LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL,
alpha, 0, 0.5);
}
return chiSquareTestDataSetsComparison(observed1, observed2) < alpha;
}
示例5: kolmogorovSmirnovTest
/**
* Performs a <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test"> Kolmogorov-Smirnov
* test</a> evaluating the null hypothesis that {@code data} conforms to {@code distribution}.
*
* @param distribution reference distribution
* @param data sample being being evaluated
* @param alpha significance level of the test
* @return true iff the null hypothesis that {@code data} is a sample from {@code distribution}
* can be rejected with confidence 1 - {@code alpha}
* @throws InsufficientDataException if {@code data} does not have length at least 2
* @throws NullArgumentException if {@code data} is null
*/
public boolean kolmogorovSmirnovTest(RealDistribution distribution, double[] data, double alpha) {
if ((alpha <= 0) || (alpha > 0.5)) {
throw new OutOfRangeException(LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL, alpha, 0, 0.5);
}
return kolmogorovSmirnovTest(distribution, data) < alpha;
}
示例6: anovaTest
/**
* Performs an ANOVA test, evaluating the null hypothesis that there
* is no difference among the means of the data categories.
*
* <p><strong>Preconditions</strong>: <ul>
* <li>The categoryData <code>Collection</code> must contain
* <code>double[]</code> arrays.</li>
* <li> There must be at least two <code>double[]</code> arrays in the
* <code>categoryData</code> collection and each of these arrays must
* contain at least two values.</li>
* <li>alpha must be strictly greater than 0 and less than or equal to 0.5.
* </li></ul></p><p>
* This implementation uses the
* {@link org.apache.commons.math3.distribution.FDistribution
* commons-math F Distribution implementation} to estimate the exact
* p-value, using the formula<pre>
* p = 1 - cumulativeProbability(F)</pre>
* where <code>F</code> is the F value and <code>cumulativeProbability</code>
* is the commons-math implementation of the F distribution.</p>
* <p>True is returned iff the estimated p-value is less than alpha.</p>
*
* @param categoryData <code>Collection</code> of <code>double[]</code>
* arrays each containing data for one category
* @param alpha significance level of the test
* @return true if the null hypothesis can be rejected with
* confidence 1 - alpha
* @throws NullArgumentException if <code>categoryData</code> is <code>null</code>
* @throws DimensionMismatchException if the length of the <code>categoryData</code>
* array is less than 2 or a contained <code>double[]</code> array does not have
* at least two values
* @throws OutOfRangeException if <code>alpha</code> is not in the range (0, 0.5]
* @throws ConvergenceException if the p-value can not be computed due to a convergence error
* @throws MaxCountExceededException if the maximum number of iterations is exceeded
*/
public boolean anovaTest(final Collection<double[]> categoryData,
final double alpha)
throws NullArgumentException, DimensionMismatchException,
OutOfRangeException, ConvergenceException, MaxCountExceededException {
if ((alpha <= 0) || (alpha > 0.5)) {
throw new OutOfRangeException(
LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL,
alpha, 0, 0.5);
}
return anovaPValue(categoryData) < alpha;
}