Package org.apache.commons.math3.distribution

Examples of org.apache.commons.math3.distribution.ChiSquaredDistribution


     * @param df the degrees of freedom of the ChiSquare distribution
     * @return random value sampled from the ChiSquare(df) distribution
     * @since 2.2
     */
    public double nextChiSquare(double df) {
        return nextInversionDeviate(new ChiSquaredDistribution(df));
    }
View Full Code Here


     */
    public double chiSquareTest(final double[] expected, final long[] observed)
        throws NotPositiveException, NotStrictlyPositiveException,
        DimensionMismatchException, MaxCountExceededException {

        ChiSquaredDistribution distribution =
            new ChiSquaredDistribution(expected.length - 1.0);
        return 1.0 - distribution.cumulativeProbability(chiSquare(expected, observed));

    }
View Full Code Here

        throws NullArgumentException, DimensionMismatchException,
        NotPositiveException, MaxCountExceededException {

        checkArray(counts);
        double df = ((double) counts.length -1) * ((double) counts[0].length - 1);
        ChiSquaredDistribution distribution;
        distribution = new ChiSquaredDistribution(df);
        return 1 - distribution.cumulativeProbability(chiSquare(counts));

    }
View Full Code Here

     */
    public double chiSquareTestDataSetsComparison(long[] observed1, long[] observed2)
        throws DimensionMismatchException, NotPositiveException, ZeroException,
        MaxCountExceededException {

        ChiSquaredDistribution distribution;
        distribution = new ChiSquaredDistribution((double) observed1.length - 1);
        return 1 - distribution.cumulativeProbability(
                chiSquareDataSetsComparison(observed1, observed2));

    }
View Full Code Here

     *
     * @param df the degrees of freedom of the ChiSquare distribution
     * @return random value sampled from the ChiSquare(df) distribution
     */
    public double nextChiSquare(double df) {
        return new ChiSquaredDistribution(getRandomGenerator(), df,
                ChiSquaredDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample();
    }
View Full Code Here

        TestUtils.assertChiSquareAccept(expected, counts, 0.001);
    }

    @Test
    public void testNextChiSquare() {
        double[] quartiles = TestUtils.getDistributionQuartiles(new ChiSquaredDistribution(12));
        long[] counts = new long[4];
        randomData.reSeed(1000);
        for (int i = 0; i < 1000; i++) {
            double value = randomData.nextChiSquare(12);
            TestUtils.updateCounts(value, counts, quartiles);
View Full Code Here

     */
    public double gTest(final double[] expected, final long[] observed)
            throws NotPositiveException, NotStrictlyPositiveException,
            DimensionMismatchException, MaxCountExceededException {

        final ChiSquaredDistribution distribution =
                new ChiSquaredDistribution(expected.length - 1.0);
        return 1.0 - distribution.cumulativeProbability(
                g(expected, observed));
    }
View Full Code Here

     */
    public double gTestIntrinsic(final double[] expected, final long[] observed)
            throws NotPositiveException, NotStrictlyPositiveException,
            DimensionMismatchException, MaxCountExceededException {

        final ChiSquaredDistribution distribution =
                new ChiSquaredDistribution(expected.length - 2.0);
        return 1.0 - distribution.cumulativeProbability(
                g(expected, observed));
    }
View Full Code Here

     */
    public double gTestDataSetsComparison(final long[] observed1,
            final long[] observed2)
            throws DimensionMismatchException, NotPositiveException, ZeroException,
            MaxCountExceededException {
        final ChiSquaredDistribution distribution = new ChiSquaredDistribution(
                (double) observed1.length - 1);
        return 1 - distribution.cumulativeProbability(
                gDataSetsComparison(observed1, observed2));
    }
View Full Code Here

            container.add(comp, c);
           
            c.gridx++;
            comp = createComponent("ChiSquared", 0, 5,
                                   new String[] { "k=1", "k=2", "k=3", "k=4", "k=6" },
                                   new ChiSquaredDistribution(1),
                                   new ChiSquaredDistribution(2),
                                   new ChiSquaredDistribution(3),
                                   new ChiSquaredDistribution(4),
                                   new ChiSquaredDistribution(6));
            container.add(comp, c);

            c.gridy++;
            c.gridx = 0;
            comp = createComponent("Exponential", 0, 5,
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.distribution.ChiSquaredDistribution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.