Skip to main content

compute the incomplete Beta function and its derivatives

Project description

## Welcome

This tiny library contains some C/Cython code for calculating
- the (normalized) incomplete Beta function - `betainc`
- the first derivatives (w.r.t. shape parameters) of the incomplete Beta function
via the INBEDER algorithm
- the digamma (Psi) function, the beta function and its logarithm (`betaln`)

## API

- **`beta(p, q)`**: Calculate the Beta function, where `B(p,q) = Gamma(p)*Gamma(q)/Gamma(p+q)`
- **`betaln(p, q)`**: Calculate the logarithm of the Beta function, where `betaln(p,q) = ln B(p,q) = ln Gamma(p) + ln Gamma(q) - ln Gamma(p+q)`
- **`betainc(x, p, q)`**: Calculate the regularized incomplete Beta function, where `betainc(x, p, q) = I_x(p, q)`. See http://mathworld.wolfram.com/IncompleteBetaFunction.html
- **`betaincderp(x, p, q)`**: Compute the first derivative of the regularized incomplete Beta function with respect to the first shape parameter ``p``.
- **`betaincderq(x, p, q)`**: First derivative of the regularized incomplete Beta function with respect to the second shape parameter ``q``.
- **`digamma(x)`**: The digamma function. See http://mathworld.wolfram.com/DigammaFunction.html.

## Installation

```bash
$ pip install betaincder
```

## Usage

The functions can be invoked from python, or `cimport`ed from Cython.

```python
from betaincder import betainc, betaincderp, betaincderq
print betaincderq(.5, 10, 10)
```

or

```python
%%cython
from betaincder.c.betaincder cimport digamma, betaln, betainc, betaincderq
print betaincderq(.5, 10, 10)
```

## References
- Robinson-Cox, J. F., & Boik, R. J. (1998). Derivatives of the Incomplete Beta Function. Journal of Statistical Software, 3(01).
- Bernardo, Jose M. "Algorithm AS 103: Psi (digamma) function." Journal of the Royal Statistical Society. Series C (Applied Statistics) 25.3 (1976): 315-317.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

betaincder-0.1.tar.gz (26.0 kB view details)

Uploaded Source

File details

Details for the file betaincder-0.1.tar.gz.

File metadata

  • Download URL: betaincder-0.1.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.14

File hashes

Hashes for betaincder-0.1.tar.gz
Algorithm Hash digest
SHA256 bf291d29b12934846cafceac80e43a6f3b847a029de61f5a19fd1d930a1a57f0
MD5 20246f213c01fde8f8518551e0a76190
BLAKE2b-256 1da2650b9b5248aa5ec090e3f92b5e5257a1062e10b6e481d837f6e8f5f9825f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page