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.math.distribution.TDistribution

         * @throws MathException if an error occurs computing the p-value
         */
        protected double tTest(double m, double mu, double v, double n)
        throws MathException {
            double t = Math.abs(t(m, mu, v, n));
            TDistribution tDistribution =
                getDistributionFactory().createTDistribution(n - 1);
            return 1.0 - tDistribution.cumulativeProbability(-t, t);
        }
    View Full Code Here

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

                double n1, double n2)
        throws MathException {
            double t = Math.abs(t(m1, m2, v1, v2, n1, n2));
            double degreesOfFreedom = 0;
            degreesOfFreedom= df(v1, v2, n1, n2);
            TDistribution tDistribution =
                getDistributionFactory().createTDistribution(degreesOfFreedom);
            return 1.0 - tDistribution.cumulativeProbability(-t, t);
        }
    View Full Code Here

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

                double v2, double n1, double n2)
        throws MathException {
            double t = Math.abs(t(m1, m2, v1, v2, n1, n2));
            double degreesOfFreedom = 0;
                degreesOfFreedom = (double) (n1 + n2 - 2);
            TDistribution tDistribution =
                getDistributionFactory().createTDistribution(degreesOfFreedom);
            return 1.0 - tDistribution.cumulativeProbability(-t, t);
        }  
    View Full Code Here

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

            double v2,
            double n1,
            double n2)
            throws MathException {
            double t = Math.abs(t(m1, m2, v1, v2, n1, n2));
            TDistribution tDistribution =
                DistributionFactory.newInstance().createTDistribution(
                    df(v1, v2, n1, n2));
            return 1.0 - tDistribution.cummulativeProbability(-t, t);
        }
    View Full Code Here

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

         * @return p-value
         */
        private double tTest(double m, double mu, double v, double n)
            throws MathException {
            double t = Math.abs(t(m, mu, v, n));
            TDistribution tDistribution =
                DistributionFactory.newInstance().createTDistribution(n - 1);
            return 1.0 - tDistribution.cummulativeProbability(-t, t);
        }
    View Full Code Here

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

         *
         * @return matrix of p-values
         * @throws MathException if an error occurs estimating probabilities
         */
        public RealMatrix getCorrelationPValues() throws MathException {
            TDistribution tDistribution = new TDistributionImpl(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 = Math.abs(r * Math.sqrt((nObs - 2)/(1 - r * r)));
                        out[i][j] = 2 * (1 - tDistribution.cumulativeProbability(t));
                    }
                }
            }
            return new BlockRealMatrix(out);
        }
    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
         * @throws NotStrictlyPositiveException if {@code df <= 0}
         */
        public double nextT(double df) throws NotStrictlyPositiveException {
            return new TDistribution(getRandomGenerator(), df,
                    TDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample();
        }
    View Full Code Here

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

            if (alpha >= 1 || alpha <= 0) {
                throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL,
                                              alpha, 0, 1);
            }
            // No advertised NotStrictlyPositiveException here - will return NaN above
            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

        public double getSignificance() {
            if (n < 3) {
                return Double.NaN;
            }
            // No advertised NotStrictlyPositiveException here - will return NaN above
            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

         * @throws org.apache.commons.math3.exception.MaxCountExceededException
         * if an error occurs estimating probabilities
         * @throws NullPointerException if this instance was created with no data
         */
        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
    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.