MDmiss {modi} | R Documentation |
Mahalanobis distance (MD) for data with missing values
Description
For each observation the missing dimensions are omitted
before calculating the MD. The MD contains a correction
factor to account for the number of observed values,
where
is the number of variables and
is the number of
observed dimensions for the particular observation.
Usage
MDmiss(data, center, cov)
Arguments
data |
the data as a dataframe or matrix. |
center |
the center to be used (may not contain missing values). |
cov |
the covariance to be used (may not contain missing values). |
Details
The function loops over the observations. This is not optimal if only a few missingness patterns occur. If no missing values occur the function returns the Mahalanobis distance.
Value
The function returns a vector of the (squared) Mahalanobis distances.
Author(s)
Beat Hulliger
References
Béguin, C., and Hulliger, B. (2004). Multivariate outlier detection in incomplete survey data: The epidemic algorithm and transformed rank correlations. Journal of the Royal Statistical Society, A167 (Part 2.), pp. 275-294.
See Also
Examples
data(bushfirem, bushfire)
MDmiss(bushfirem, apply(bushfire, 2, mean), var(bushfire))