Package org.apache.commons.math.distribution

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

@version $Revision: 920852 $ $Date: 2010-03-09 13:53:44 +0100 (mar. 09 mars 2010) $

     * @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


            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

            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

        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

     * @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

     *
     * @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

TOP

Related Classes of org.apache.commons.math.distribution.TDistribution

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.