Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4314 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

  • Newbies
Posted

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 ?

 

This topic is 4314 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.