Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Statistics in Java

Featured Replies

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

Solved by john renfrew

Go to solution
  • Solution

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

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 ?

 

Create an account or sign in to comment

Similar Content

Important Information

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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.