Code Monkey home page Code Monkey logo

fishersexacttest's People

Contributors

painyeph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

linhxxx mrtomrod

fishersexacttest's Issues

Exceptions

Dear painyeph

I found that for very few contingency tables, your implementation fails:

a, b, c, d = (2, 3, 0, 2)
fisher.test1t(a, b, c, d)  #0.5238095238095246
scipy.stats.fisher_exact([[a, b], [c, d]], 'two-sided')[1]  # 1.0

Even faster version using Cython

Hey painyeph

Thanks a lot for your great work!

I lazily wanted to see how much faster your tool would be using numba / Cython. The result is quite impressive, see my repo!

https://github.com/MrTomRod/fast-fisher

a b c d test type scipy f_python f_compiled
8 2 1 5 left-tailed 130 us 3 us 1 us
8 2 1 5 right-tailed 134 us 3 us 0 us
8 2 1 5 two-tailed 884 us 6 us 1 us
100 1000 10000 100000 left-tailed 153 us 57 us 5 us
100 1000 10000 100000 right-tailed 218 us 73 us 6 us
100 1000 10000 100000 two-tailed 174 us 130 us 10 us
10000 100 1000 100000 left-tailed 955 us 8 us 1 us
10000 100 1000 100000 right-tailed 135 us 7 us 1 us
10000 100 1000 100000 two-tailed 62821 us 753 us 53 us
10000 10000 10000 10000 left-tailed 900 us 323 us 26 us
10000 10000 10000 10000 right-tailed 912 us 329 us 27 us
10000 10000 10000 10000 two-tailed 172 us 679 us 53 us

f_python is your version, f_compiled is mine.

I added the MIT licence. Hope that's ok for you.

The only downside is that numba is added as a dependency.

The newest version is a Cython module with almost the same performance as numba. The only dependency is now that python-devel must be installed.

Shall I make a pull request?

Best,
MrTomRod

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.