Results 1 to 3 of 3

Thread: Chi sqaure test

  1. #1
    newto is offline Member
    Join Date
    May 2010
    Posts
    17
    Rep Power
    0

    Default Chi sqaure test

    Hi,
    I want to do Chi-square test, to find the weather two distribution are same or not.

    I want to use some statistical function to do that.
    i found common math library to that test.

    But I don't know how to use that library.
    Math - Commons-Math: The Apache Commons Mathematics Library

    and I find the code as

    long[] observed = {10, 9, 11};
    double[] expected = {10.1, 9.8, 10.3};
    System.out.println(TestUtils.chiSquare(expected, observed));


    If anyone can give me the idea about how to sue it, that will be very helpful for me.

    Thank you

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,883
    Rep Power
    25

    Default

    What happens when you execute your program?
    If the answer is wrong, can you explain what it should be?

  3. #3
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    To calculate the chi-squared value for simple data, you don't need any special library. All you have to do is to apply the formula for the calculation to the data:
    http://en.wikipedia.org/wiki/Chi-square_statistic

    Now to get a p value from the chi-square result and your degree of freedoms, you'll need to use a look-up table or some external library.

Similar Threads

  1. Help with this test class
    By fsuarjun03 in forum New To Java
    Replies: 10
    Last Post: 06-20-2011, 04:56 AM
  2. Is it possible to test for NaN?
    By AJArmstron@aol.com in forum New To Java
    Replies: 7
    Last Post: 05-07-2010, 03:22 AM
  3. Test - please delete
    By Fubarable in forum Forum Lobby
    Replies: 7
    Last Post: 04-25-2009, 09:08 PM
  4. JUnit Test Help!
    By pharo in forum New To Java
    Replies: 0
    Last Post: 04-10-2009, 06:15 PM
  5. Replies: 0
    Last Post: 04-05-2008, 01:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •