xicor

XI Correlation Coefficient in Postgres

Overview

PackageVersionCategoryLicenseLanguage
pgxicor0.1.1FUNCGPL-3.0C
IDExtensionBinLibLoadCreateTrustRelocSchema
4670xicorNoYesNoYesYesYes-
Relatedpg_idkit pgx_ulid pg_uuidv7 permuteseq pg_hashids sequential_uuids topn quantile

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.1.11817161514pgxicor-
RPMPIGSTY0.1.11817161514pgxicor_$v-
DEBPIGSTY0.1.11817161514postgresql-$v-pgxicor-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
d13.x86_64
d13.aarch64
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
u22.x86_64
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
u22.aarch64
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
u24.x86_64
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
u24.aarch64
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1
PIGSTY 0.1.1

Build

You can build the RPM / DEB packages for pgxicor using pig build:

pig build pkg pgxicor         # build RPM / DEB packages

Install

You can install pgxicor directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install pgxicor;          # Install for current active PG version
pig ext install -y pgxicor -v 18  # PG 18
pig ext install -y pgxicor -v 17  # PG 17
pig ext install -y pgxicor -v 16  # PG 16
pig ext install -y pgxicor -v 15  # PG 15
pig ext install -y pgxicor -v 14  # PG 14
dnf install -y pgxicor_18       # PG 18
dnf install -y pgxicor_17       # PG 17
dnf install -y pgxicor_16       # PG 16
dnf install -y pgxicor_15       # PG 15
dnf install -y pgxicor_14       # PG 14
apt install -y postgresql-18-pgxicor   # PG 18
apt install -y postgresql-17-pgxicor   # PG 17
apt install -y postgresql-16-pgxicor   # PG 16
apt install -y postgresql-15-pgxicor   # PG 15
apt install -y postgresql-14-pgxicor   # PG 14

Create Extension:

CREATE EXTENSION xicor;

Usage

Sources: README, release 0.1.1

xicor exposes the XI (Chatterjee’s xi) correlation coefficient as a PostgreSQL aggregate. It is meant for detecting functional dependence, including non-linear relationships that Pearson’s corr() can miss.

CREATE EXTENSION xicor;

Main Aggregate

SELECT xicor(x, y) FROM xicor_test;

The upstream example contrasts it with corr() on a parabola-shaped dataset, where corr() is near zero while xicor() remains high.

Example

CREATE TABLE xicor_test (x float8, y float8);
INSERT INTO xicor_test (x, y) VALUES
  (1.0, 2.0),
  (2.5, 3.5),
  (3.0, 4.0),
  (4.5, 5.5),
  (5.0, 6.0);

SELECT xicor(x, y) FROM xicor_test;

Reproducibility Controls

For tied data, upstream recommends enabling deterministic tie handling:

SET xicor.ties = true;
SET xicor.seed = 42;

Caveats

  • xicor() is an aggregate over two numeric inputs, not a general-purpose statistical framework.
  • Tie handling can change results unless you enable the documented GUCs for reproducible behavior.

Last Modified 2026-04-19: update extension stub docs (9f178c3)