Examples of Median


Examples of org.apache.commons.math.stat.descriptive.rank.Median

    return meanCalculator.evaluate(values);
  }
 
  public static Double median(double[] values)
  {
    Median medianCalculator = new Median();
    return medianCalculator.evaluate(values);
  }
View Full Code Here

Examples of org.apache.commons.math.stat.descriptive.rank.Median

    public static double getMedianTestScore(int testID)
        throws SQLException
    {
        Logger              log = Logger.getLogger();
        boolean             loggingEnabled = log.isLoggingEnabled();
        Median              median = new Median();
        ArrayList           arraylist = new ArrayList();
        Connection          conn = getDefaultConnection();

        try {
            log.enableLogging( false );
           
            PreparedStatement   ps = Utils.prepare
                (
                 conn,
                 "select tk.score\n" +
                 "from TestTaking tk, LastTaking lt\n" +
                 "where tk.takingID = lt.takingID\n" +
                 "and tk.testID = ?\n"
                 );
           
            ps.setInt( 1, testID );
           
            ResultSet           rs = ps.executeQuery();
           
            while( rs.next() )
            {
                arraylist.add(new Double(rs.getDouble(1)));
            }
           
            Utils.close(rs);
            Utils.close(ps);
        }
        finally
        {
            log.enableLogging( loggingEnabled );
        }

        int                 count = arraylist.size();
        double              values[] = new double[ count ];

        for ( int i = 0; i < count; i++)
        { values[ i ] = ((Double)arraylist.get(i)).doubleValue(); }

        return median.evaluate( values );
    }
View Full Code Here

Examples of org.apache.commons.math3.stat.descriptive.rank.Median

    public static double getMedianTestScore(int testID)
        throws SQLException
    {
        Logger              log = Logger.getLogger();
        boolean             loggingEnabled = log.isLoggingEnabled();
        Median              median = new Median();
        ArrayList           arraylist = new ArrayList();
        Connection          conn = getDefaultConnection();

        try {
            log.enableLogging( false );
           
            PreparedStatement   ps = Utils.prepare
                (
                 conn,
                 "select tk.score\n" +
                 "from TestTaking tk, LastTaking lt\n" +
                 "where tk.takingID = lt.takingID\n" +
                 "and tk.testID = ?\n"
                 );
           
            ps.setInt( 1, testID );
           
            ResultSet           rs = ps.executeQuery();
           
            while( rs.next() )
            {
                arraylist.add(new Double(rs.getDouble(1)));
            }
           
            Utils.close(rs);
            Utils.close(ps);
        }
        finally
        {
            log.enableLogging( loggingEnabled );
        }

        int                 count = arraylist.size();
        double              values[] = new double[ count ];

        for ( int i = 0; i < count; i++)
        { values[ i ] = ((Double)arraylist.get(i)).doubleValue(); }

        return median.evaluate( values );
    }
View Full Code Here

Examples of org.boris.expr.function.excel.MEDIAN

        MAXA m = new MAXA();
        assertEquals(eval(m, 10, 7, 9, 27, 2), 27.);
    }

    public void testMEDIAN() throws Exception {
        MEDIAN m = new MEDIAN();
        fail("MEDIAN not implemented");
    }
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.