Examples of TDistribution

@version $Revision: 920852 $ $Date: 2010-03-09 13:53:44 +0100 (mar. 09 mars 2010) $
  • org.apache.commons.math3.distribution.TDistribution
    pedia.org/wiki/Student's_t-distribution'>Student's t-distribution (Wikipedia)" @see "Student's t-distribution (MathWorld)"

  • Examples of org.apache.commons.math3.distribution.TDistribution

                               final double v, final double n)
            throws MaxCountExceededException, MathIllegalArgumentException {

            final double t = FastMath.abs(t(m, mu, v, n));
            // pass a null rng to avoid unneeded overhead as we will not sample from this distribution
            final TDistribution distribution = new TDistribution(null, n - 1);
            return 2.0 * distribution.cumulativeProbability(-t);

        }
    View Full Code Here

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

            throws MaxCountExceededException, NotStrictlyPositiveException {

            final double t = FastMath.abs(t(m1, m2, v1, v2, n1, n2));
            final double degreesOfFreedom = df(v1, v2, n1, n2);
            // pass a null rng to avoid unneeded overhead as we will not sample from this distribution
            final TDistribution distribution = new TDistribution(null, degreesOfFreedom);
            return 2.0 * distribution.cumulativeProbability(-t);

        }
    View Full Code Here

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

            throws MaxCountExceededException, NotStrictlyPositiveException {

            final double t = FastMath.abs(homoscedasticT(m1, m2, v1, v2, n1, n2));
            final double degreesOfFreedom = n1 + n2 - 2;
            // pass a null rng to avoid unneeded overhead as we will not sample from this distribution
            final TDistribution distribution = new TDistribution(null, degreesOfFreedom);
            return 2.0 * distribution.cumulativeProbability(-t);

        }
    View Full Code Here

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

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

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

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

        public double getSlopeConfidenceInterval(final double alpha) {
            if (alpha >= 1 || alpha <= 0) {
                throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                              alpha, 0, 1);
            }
            TDistribution distribution = new TDistribution(n - 2);
            return getSlopeStdErr() *
                distribution.inverseCumulativeProbability(1d - alpha / 2d);
        }
    View Full Code Here

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

         * @return significance level for slope/correlation
         * @throws org.apache.commons.math3.exception.MaxCountExceededException
         * if the significance level can not be computed.
         */
        public double getSignificance() {
            TDistribution distribution = new TDistribution(n - 2);
            return 2d * (1.0 - distribution.cumulativeProbability(
                        FastMath.abs(getSlope()) / getSlopeStdErr()));
        }
    View Full Code Here

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

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

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

         * @return matrix of p-values
         * @throws org.apache.commons.math3.exception.MaxCountExceededException
         * if an error occurs estimating probabilities
         */
        public RealMatrix getCorrelationPValues() {
            TDistribution tDistribution = new TDistribution(nObs - 2);
            int nVars = correlationMatrix.getColumnDimension();
            double[][] out = new double[nVars][nVars];
            for (int i = 0; i < nVars; i++) {
                for (int j = 0; j < nVars; j++) {
                    if (i == j) {
                        out[i][j] = 0d;
                    } else {
                        double r = correlationMatrix.getEntry(i, j);
                        double t = FastMath.abs(r * FastMath.sqrt((nObs - 2)/(1 - r * r)));
                        out[i][j] = 2 * tDistribution.cumulativeProbability(-t);
                    }
                }
            }
            return new BlockRealMatrix(out);
        }
    View Full Code Here

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

        protected double tTest(final double m, final double mu,
                               final double v, final double n)
            throws MaxCountExceededException {

            double t = FastMath.abs(t(m, mu, v, n));
            TDistribution distribution = new TDistribution(n - 1);
            return 2.0 * distribution.cumulativeProbability(-t);

        }
    View Full Code Here

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

                               final double n1, final double n2)
            throws MaxCountExceededException {

            final double t = FastMath.abs(t(m1, m2, v1, v2, n1, n2));
            final double degreesOfFreedom = df(v1, v2, n1, n2);
            TDistribution distribution = new TDistribution(degreesOfFreedom);
            return 2.0 * distribution.cumulativeProbability(-t);

        }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.