infocentroid: Information-Dense Centroid Metrics

infocentroid is an R package that provides information-theoretic alternatives to classical central tendency and dispersion metrics. While classical statistics (mean and standard deviation) are highly sensitive to outliers and multimodal distributions, the Information-Dense Centroid (IDC) focuses on the actual probability density of the data, capturing the region where the bulk of the information resides.

Methodology

In real-world data, distributions are often skewed, bimodal, or contaminated with outliers. A standard mean might fall into a “valley” where no actual data points exist. The IDC method uses Kernel Density Estimation (KDE) or histograms to assign entropy-based weights to each observation, ensuring that the calculated center reflects the true information density.

Empirical Comparison: Why IDC Matters

We simulated three different scenarios to demonstrate the robustness of infocentroid compared to classical statistics:

Metric Normal Data Symmetric Bimodal Data Data with Outliers
Classical Mean 49.74 49.97 (Falls in the empty valley) 51.49 (Dragged by outliers)
Classical SD 10.03 30.60 15.73 (Inflated)
IDC Center (ic_center) 49.74 49.91 50.04 (Robust)
IDC Dispersion (ic_dispersion) 9.25 30.65 2.38 (Accurate)

As demonstrated in the Data with Outliers column, 10 extreme values (around 200) completely skew the classical mean and standard deviation. However, IDC successfully ignores the noise and locks onto the true center (50) and true dispersion (sd = 5).

The Alpha Parameter

The alpha parameter controls the sharpness of the density focus. A higher alpha forces the metric to lock onto the most dominant peak (mode) of the distribution.

Installation

You can install the development version of infocentroid from GitHub:

# install.packages("devtools")
devtools::install_github("ahmetkutuk1/infocentroid")

Usage

Here is a quick example demonstrating how to use the core functions:

library(infocentroid)

# Create a dataset with an extreme outlier
set.seed(42)
data <- c(rnorm(99, mean = 50, sd = 5), 500) # 500 is an extreme outlier

# Classical metrics
mean(data) # Heavily skewed by the outlier
sd(data)   # Inflated

# Information-Dense Centroid metrics
ic_center(data)     # Robust center
ic_dispersion(data) # Robust dispersion

# Get a combined 0-1 information density score
ic_combined(data)

# Visualize the density and the IDC center
ic_plot(data)

Core Functions

License

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