dist_cstep: Computes Mahalanobis Distances for a Given Set of H-Subsets

View source: R/RcppExports.R

dist_cstepR Documentation

Computes Mahalanobis Distances for a Given Set of H-Subsets

Description

This function calculates the Mahalanobis distances for a set of observations by centering them with the mean vector and using a covariance matrix computed as a weighted combination of the covariance matrix of the current item and the covariance matrices of its neighbors.

Usage

dist_cstep(init, i, lambda, weights)

Arguments

init

A list of items where each item contains the following elements:

  • mX A matrix of observations (one column per observation).

  • vMu A vector of means.

  • mS A covariance matrix of the observations in mX.

i

An integer index specifying which item from the init list to use.

lambda

A numeric value representing the weight for the covariance matrix of the current item.

weights

A matrix of weights where each element weights(i, j) specifies the weight of the j-th item for the i-th item.

Details

The Mahalanobis distances are computed using the covariance matrix, which is a weighted combination of the current item's covariance matrix and those of its neighbors. The covariance matrix is smoothed using the parameter lambda and the distances are computed as (x_centered^T * Cov_matrix_chol_inv * x_centered) for each observation.

Value

A numeric vector of distances for each observation in the centered matrix.


ssMRCD documentation built on Nov. 5, 2025, 7:44 p.m.