Skip to main content

A Python package for correlation analysis between ordinal variables

Project description

ordinalcorr: correlation coefficients for ordinal variables

PyPI version License Unit Tests

ordinalcorr is a Python package designed to compute correlation coefficients tailored for ordinal-scale data (e.g., Likert items). It supports polychoric correlation coefficients and other coefficients for ordinal data.

📦 Installation

pip install ordinalcorr

✨ Features

This package provides several correlation coefficients for many types of variables

Variable X Variable Y Method Function
binary binary Tetrachoric correlation tetrachoric_corr
ordinal ordinal Polychoric correlation polychoric_corr
continuous ordinal Polyserial correlation polyserial_corr
continuous binary (discretized from continuous) Biserial correlation biserial_corr
continuous binary Point-Biserial correlation point_biserial_corr

Example

Here is an example for computing correlation coefficient between two ordinal variables

from ordinalcorr import polychoric_corr

x = [1, 1, 2, 2, 3, 3]
y = [0, 0, 0, 1, 1, 1]

rho = polychoric_corr(x, y)
print(f"Polychoric correlation: {rho:.3f}")

📒 Document

Full document is here

⚖️ License

This project is licensed under the MIT License. See the LICENSE file for details.

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

ordinalcorr-0.3.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

ordinalcorr-0.3.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file ordinalcorr-0.3.0.tar.gz.

File metadata

  • Download URL: ordinalcorr-0.3.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for ordinalcorr-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1b3c1c1c05430ad41e152a9cf2d25944f773f700ba6052eb10e9ec08c76ec341
MD5 c8a108ed4b80e368302beeb946be5a4b
BLAKE2b-256 8f8dad03ced241bf86d55999628f5218bfe00fd6007935091f58620985f81187

See more details on using hashes here.

File details

Details for the file ordinalcorr-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ordinalcorr-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for ordinalcorr-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c606eaf5398875fbb8a6e74194e294942a0a597b1815af9ad7c10b340b0c1847
MD5 5e5eca9a5fb74114e58c489d93e53047
BLAKE2b-256 266d5b925d57ad81c118410b838db8a494ad2a4a32f590e195ac713f71832745

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