IMah_dist: Interval-Mahalanobis Distance

View source: R/int_distances.r

IMah_distR Documentation

Interval-Mahalanobis Distance

Description

Calculate the squared Interval-Mahalanobis distance of all rows in the data and the barycenter.

Usage

IMah_dist(
  data,
  z = NULL,
  mean_c = NULL,
  mean_r = NULL,
  cov = NULL,
  mean = NULL
)

Arguments

data

An intData object containing the macrodata/interval data

z

(Optional) A vector of 0 and 1, indicating which observations should be considered for the calculation. If z is not NULL, mean_c, mean_r, and cov will be computed using only the observations with z=1 (see int_mean_z and int_cov_z). Overrules mean_c, mean_r, cov, and mean if they are provided. Defaults to NULL.

mean_c

(Optional) A vector specifying the mean of centers. Defaults to NULL, in which case it will be computed using the IMCD function, if z is also NULL.

mean_r

(Optional) A vector specifying the mean of ranges. Defaults to NULL, in which case it will be computed using the IMCD function, if z is also NULL.

cov

(Optional) A covariance matrix. Defaults to NULL, in which case it will be computed using the IMCD function, if z is also NULL.

mean

(Optional) An intData object containing the barycenter of the data. If provided, it will override mean_c and mean_r.

Details

The squared Interval-Mahalanobis distance between \boldsymbol{x}=(\boldsymbol{c}^\top,\boldsymbol{r}^\top)^\top and the barycenter \boldsymbol{\mu}_B=(\boldsymbol{\mu}_C^\top,\boldsymbol{\mu}_R^\top)^\top of a population with symbolic covariance matrix \boldsymbol{\Sigma}_B (see int_cov) is defined according to the LatentCase:

  • "U_id_symmetric": The latent variables are identically distributed and symmetric:

    d_\mathrm{IMah}(\boldsymbol{x})^2=(\boldsymbol{c}-\boldsymbol{\mu}_C)^{\top}\boldsymbol{\Sigma}_{B}^{-1}(\boldsymbol{c}-\boldsymbol{\mu}_C)+\delta(\boldsymbol{r}-\boldsymbol{\mu}_R)^{\top}\boldsymbol{\Sigma}_{B}^{-1}(\boldsymbol{r}-\boldsymbol{\mu}_R),

    where \delta=\mathbb{E}(U^2)/4 is the parameter of the latent variables.

  • "U_id": The latent variables are identically distributed:

    \begin{aligned} d_\mathrm{IMah}(\boldsymbol{x})^2&=(\boldsymbol{c}-\boldsymbol{\mu}_C)^{\top}\boldsymbol{\Sigma}_{B}^{-1}(\boldsymbol{c}-\boldsymbol{\mu}_C)+\delta(\boldsymbol{r}-\boldsymbol{\mu}_R)^{\top}\boldsymbol{\Sigma}_{B}^{-1}(\boldsymbol{r}-\boldsymbol{\mu}_R)\\ &\quad+\mathbb{E}(U)(\boldsymbol{c}-\boldsymbol{\mu}_C)^\top\boldsymbol{\Sigma}_{B}^{-1}(\boldsymbol{r}-\boldsymbol{\mu}_R), \end{aligned}

    where \delta=\mathbb{E}(U^2)/4 and \mathbb{E}(U) are the parameter of the latent variables.

  • "General": The latent variables do not have any nice properties:

    \begin{aligned} d_\mathrm{IMah}(\boldsymbol{x})^2&=(\boldsymbol{c}-\boldsymbol{\mu}_C)^{\top}\boldsymbol{\Sigma}_{B}^{-1}(\boldsymbol{c}-\boldsymbol{\mu}_C)+\dfrac{1}{4}(\boldsymbol{r}-\boldsymbol{\mu}_R)^{\top}\left(\boldsymbol{\mathfrak{E}}_{UU}\bullet\boldsymbol{\Sigma}_{B}^{-1}\right)(\boldsymbol{r}-\boldsymbol{\mu}_R)\\ &\quad+(\boldsymbol{c}-\boldsymbol{\mu}_C)^{\top}\boldsymbol{\Sigma}_{B}^{-1}\boldsymbol{\Psi}(\boldsymbol{r}-\boldsymbol{\mu}_R), \end{aligned}

    where:

    • \boldsymbol{\Psi}=\text{diag}(\mathbb{E}(U_1),\dots,\mathbb{E}(U_p)),

    • [\boldsymbol{\mathfrak{E}}_{UU}]_{j\ell}=\mathcal{E}(U_j,U_\ell), j\neq \ell, with \mathcal{E}(U_j,U_\ell)=\int_0^1 F_{U_j}^{-1}(t) F_{U_\ell}^{-1}(t) \, dt,

    • [\boldsymbol{\mathfrak{E}}_{UU}]_{jj}=\mathbb{E}(U_j^2), j,\ell=1,\dots,p,

    • \bullet denotes the Schur (or entrywise) product of matrices.

Value

A vector with the squared Interval-Mahalanobis distance of each observation.

References

Loureiro, C. P., Oliveira, M. R., Brito, P., & Oliveira, L. (2026). Minimum Covariance Determinant Estimator and Outlier Detection for Interval-valued Data. arXiv preprint arXiv:2604.26769. https://arxiv.org/abs/2604.26769

Examples

data(creditcard)
credit_card_int <- creditcard$intData

# Compute squared Interval-Mahalanobis distance using IMCD estimates of mean and covariance
credit_card_dist <- IMah_dist(credit_card_int)

# Compute non-robust squared Interval-Mahalanobis distance using sample mean and covariance
credit_card_dist_nonrobust <- IMah_dist(credit_card_int, z = rep(1, credit_card_int@NObs))

AIDA documentation built on Nov. 4, 2026, 9:06 a.m.