Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keisukenagakawa/cisim
Hypegeometric confidence interval calculator.
https://github.com/keisukenagakawa/cisim
scipy simulation statistics
Last synced: 27 days ago
JSON representation
Hypegeometric confidence interval calculator.
- Host: GitHub
- URL: https://github.com/keisukenagakawa/cisim
- Owner: KeisukeNagakawa
- License: mit
- Created: 2020-07-15T12:29:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-19T12:04:35.000Z (about 4 years ago)
- Last Synced: 2024-10-11T12:21:48.828Z (27 days ago)
- Topics: scipy, simulation, statistics
- Language: Python
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Confidence Interval of Hypergeometric Distribution Simulation Module
=====================================================================For a hypergeometric distribution, denoted by :math:`Hyper(n_pop, k_s, n_draw)`, where :math:`n_pop` is the population size, :math:`k_s` is the number of population with 'success', and :math:`n_draw` is the given sample size, this program calculates the confidence interval for :math:`k_s` when :math:`n_pop` is known and number of observed success is given as :math:`k_s_obs`, using simulation scipy optimization tools.
Note that this is done by a simulation and can have unaccurate values as a solution. Please cross-check with other site calculating confidence interval of hypergeometric function like here: `cluster-text.com `_.
PyPI package link is `here `_.
===============================================================
First, pip install this package.
shell
.. code-block:: shell
pip install cisim
Note: if this installing doesn't go well, please try pip install these packages: cerberus, numpy, and scipy.
After the pip-install, you can calculate the interval of a Hypergeometric distribution as follows.
python
.. code-block:: python3
import cisim
from cisim.stats import HyperCI
h = HyperCI(n_pop=10**4, n_draw=10**3, k_s_obs=100)
res = h.ci_sim()
print(res[0])
>>> [830, 1193]And this program can also calculate confidence interaval for binomial distribution, too.
.. code-block:: python3
import cisim
from cisim.stats import BinomCI
b = BinomCI(n_pop=100, n_obs=10, cl=0.05)
res = b.ci_sim()
print(res[0])
>>> [0.049005430267763495, 0.17622473596973592]You can check and compare the result with Clopper-Pearson approach on `cluster-text.com `_
Learn more at `HyperGeometric distribution `_, `Binomial Distribution `_
---------------
If you want to learn more about ``setup.py`` files, check out `this repository `_.