Traditional central tendency and dispersion measures such as the mean and standard deviation can be misleading for multimodal or outlier-contaminated data. This package implements information-theoretic alternatives that weight observations by their local probability density, focusing on the region containing the bulk of the data. The core functions include ic_weights() for kernel density or histogram based entropy weighting, ic_center() and ic_dispersion() for weighted location and spread, ic_combined() for a single information density score between zero and one, and ic_plot() for visualization.
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.
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.
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 controls the sharpness of the density focus. A higher alpha forces the metric to lock onto the most dominant peak (mode) of the distribution.
You can install the development version of infocentroid from GitHub:
# install.packages("devtools")
devtools::install_github("ahmetkutuk1/infocentroid")
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)
This project is licensed under the MIT License. See the LICENSE file for details.