New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fisher

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fisher

Fast Fisher's Exact Test

  • 0.1.14
  • PyPI
  • Socket score

Maintainers
1

Fisher's Exact Test

Package image

Simple, fast implementation of Fisher's exact test. For example, for the following table:

Having the propertyNot having the property
Selected125
Not selected292

Perhaps we are interested in whether there is any difference of property in selected vs. non-selected groups, then we can do the Fisher's exact test.

Installation

Within this folder :

git clone git://github.com/brentp/fishers_exact_test.git
pip install .

From PyPI :

pip install fisher

Or install the development version :

pip install git+git://github.com/brentp/fishers_exact_test.git

Usage

fisher.pvalue() accepts 4 values corresponding to the 2-by-2 contingency table, returns an object with attributes for left_tail, right_tail, and two_tail p-values :

>>> from fisher import pvalue
>>> mat = [[12, 5], [29, 2]]
>>> p = pvalue(12, 5, 29, 2)
>>> p.left_tail, p.right_tail, p.two_tail  # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
(0.04455473783507..., 0.994525206021..., 0.0802685520741...)

Benchmark

A simple benchmark that calls the Fisher's exact test 1000 times (in scripts/rfisher.py):

calling python fisher...
iterations/sec: 3000.62526381
calling rpy fisher...
iterations/sec: 289.225902364
calling R directly...
iterations/sec: 244.36542276

So the cython fisher is up to 10 times faster than rpy or R version.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc