Bailey Kessing Posted January 23, 2013 Posted January 23, 2013 Anyone have any familiarity with using statistic java classes with SM? Specifically we would like to use the JSC (Java Statistical Classes) found here: http://www.jsc.nildram.co.uk We need some heavy stats work and having access to this jar would be a big help. Ideas? By the way, we are currently interested in Fisher’s Exact test. Thanks
john renfrew Posted January 24, 2013 Posted January 24, 2013 Bailey Here's a quick function to get access to the functionality listed in the API // Stats ( table_data ) // 13_01_22 JR // JR // input comma sep list of values e.g.: 2,5,8,9 import jsc.contingencytables.ContingencyTable2x2 import jsc.contingencytables.FishersExactTest //test //table_data = '1,2,3,4' td = table_data.tokenize(',') ct = new ContingencyTable2x2(td[0].toInteger(), td[1].toInteger(), td[2].toInteger(), td[3].toInteger()) fet = new FishersExactTest(ct) /* enable any of these */ //return fet.getApproxSP() //return fet.getChiSquared() //return fet.getOneTailedMidP() //return fet.getOneTailedSP() //return fet.getOppositeTailProb() //return fet.getSP() //return fet.getTestStatistic() //return ct John
Bailey Kessing Posted January 25, 2013 Author Posted January 25, 2013 Thanks Works great. Just so everyone knows, you can find all the classes at: http://www.jsc.nildram.co.uk/api/index.html
Newbies Shalabh Suman Posted January 31, 2013 Newbies Posted January 31, 2013 Bailey Here's a quick function to get access to the functionality listed in the API // Stats ( table_data ) // 13_01_22 JR // JR // input comma sep list of values e.g.: 2,5,8,9 import jsc.contingencytables.ContingencyTable2x2 import jsc.contingencytables.FishersExactTest //test //table_data = '1,2,3,4' td = table_data.tokenize(',') ct = new ContingencyTable2x2(td[0].toInteger(), td[1].toInteger(), td[2].toInteger(), td[3].toInteger()) fet = new FishersExactTest(ct) /* enable any of these */ //return fet.getApproxSP() //return fet.getChiSquared() //return fet.getOneTailedMidP() //return fet.getOneTailedSP() //return fet.getOppositeTailProb() //return fet.getSP() //return fet.getTestStatistic() //return ct John Hi John, Your solution works great. Thanks! The only other issue I have is - If one of the input integers is 0, the output for return fet.getSP() is an error message. For e.g.- table_data = '0,2,3,4' , output Error is java.lang.IllegalArgumentException: Invalid variate-value 0. Any Advice on this ?
Recommended Posts
This topic is 4583 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now