Skip to main content

A Python implementation of the ecolRxC algorithm

Project description

pycolRxC

A Python implementation of the ecolRxC algorithm

Description

This project is an implementation of the ecolRxC algorithm, described[1] and originally implemented in R[2] by Jose M. Pavia and Søren Risbjerg Thomsen.

This implementation makes use of NumPy, SciPy and Numba, and reaches a 100-time speed-up compared to the original R implementation or a Python version without using Numba. This has been benchmarked with a small dataset, the same as in example.py, using timeit for the Python implementation and microbenchmark for the original R library. On this dataset, the R implementation took on average between 3 and 5 minutes, while this implementation takes about 2 to 3 seconds.

For a description of the algorithm, please consult [1], and for a simple example on using this library look at example.py.

Also, please note that only a small subset of the original library's features have been implemented. Notably, only the probit-scale Thomsen method for matrices larger than 2-by-2 has been implemented. In addition, the following have not been implemented:

  • census changes

  • references

  • confidence intervals

  • Yule’s approximation

However, most of the groundwork has been laid such that ir should be trivial to add all the capabilities of the original.

[1] Pavía, J. M., & Thomsen, S. R. (2024). ecolRxC: Ecological inference estimation of R × C tables using latent structure approaches. Political Science Research and Methods, 1–19. doi:10.1017/psrm.2024.57

[2] https://cran.r-project.org/web/packages/ecolRxC/index.html

Using pycolRxC from within R

It might be useful to use pycolRxC inside R, as an alternative to the original implementation. This can be accomplished using the reticulate package.

The file example.R contains a simple example on using pycolRxC within R.

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

pycolrxc-0.2.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycolrxc-0.2.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file pycolrxc-0.2.0.tar.gz.

File metadata

  • Download URL: pycolrxc-0.2.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pycolrxc-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ede9366bba8225cd94348f81467d261541b8542ddf94cd28d8b6c194aeb50ee7
MD5 ba28984c5d3432adf024e7dda5808ee7
BLAKE2b-256 84fb65ec97a2607f78654e5f26f063a044e94637e3f532a6ff3740b3153a3ea7

See more details on using hashes here.

File details

Details for the file pycolrxc-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pycolrxc-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pycolrxc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e5f8d8736261872abc6818996d3c43e3893c6baf73216b14af298a8018f3faf
MD5 8b432d3b951953ee69e08601ca45b2f9
BLAKE2b-256 d4864be0a54488747c820ab7422e1e2366469491294b2b9a2b18a32d9a7ddba3

See more details on using hashes here.

Supported by

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