acc_mahalanobis_ratio: Internal function only existing for technical reasons,...

View source: R/acc_mahalanobis_ratio.R

acc_mahalanobis_ratioR Documentation

Internal function only existing for technical reasons, planned to be removed in future releases

Description

Please use instead the function acc_mahalanobis()

Indicator

Usage

acc_mahalanobis_ratio(
  resp_vars = NULL,
  study_data,
  label_col = VAR_NAMES,
  item_level = "item_level",
  meta_data = item_level,
  meta_data_v2,
  meta_data_cross_item = "cross-item_level",
  cross_item_level,
  `cross-item_level`
)

Arguments

resp_vars

variable the names of the computed variable containing Mahalanobis distance ratio

study_data

data.frame the data frame that contains the measurements

label_col

variable attribute the name of the column in the metadata containing the labels of the variables

item_level

data.frame the data frame that contains metadata attributes of study data

meta_data

data.frame old name for item_level

meta_data_v2

character path or file name of the workbook like metadata file, see prep_load_workbook_like_file for details. ALL LOADED DATAFRAMES WILL BE PURGED, using prep_purge_data_frame_cache, if you specify meta_data_v2

meta_data_cross_item

data.frame – Cross-item level metadata

cross_item_level

data.frame alias for meta_data_cross_item

`cross-item_level`

data.frame alias for meta_data_cross_item

Details

[Experimental]

Value

a list with:

  • SummaryData: data.frame underlying the plot with user friendly caption

  • SummaryTable: data.frame underlying the plot

  • SummaryPlot: ggplot2::ggplot2 Q-Q plot of squared Mahalanobis distances vs. a theoretical chi-squared distribution showing outliers.

  • FlaggedStudyData data.frame contains the original data frame of the variables used to calculate the squared Mahalanobis distances with an additional column indicating if for a group of variables if the observational unit is a multivariate outlier.

ALGORITHM OF THIS IMPLEMENTATION:

  • Implementation is restricted to variables of type integer

  • Remove missing codes from the study data (if defined in the metadata)

  • The covariance matrix is estimated for all variables of resp_vars

  • The Mahalanobis distance of each observation is calculated MD^2_i = (x_i - \mu)^T \Sigma^{-1} (x_i - \mu)

  • The default to consider a value an outlier is to use the 0.975 quantile of a theoretical chi-square distribution with degrees of freedom equals to the number of variables used to calculate the Mahalanobis distance (⁠Mayrhofer and Filzmoser⁠, 2023)

See Also

Online Documentation


dataquieR documentation built on May 12, 2026, 1:06 a.m.