MDmiss: Mahalanobis distance (MD) for data with missing values.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/MDmiss.R

Description

For each observation the missing dimensions are omitted before calculating the MD. The MD contains a correction factor p/q to account for the number of observed values, where p is the number of variables and q is the number of observed dimensions for the particular observation.

Usage

1
MDmiss(data, center, cov)

Arguments

data

The data as a data frame 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\'eguin, C., and Hulliger, B. (2004). Multivariate oulier detection in incomplete survey data: The epidemic algorithm and transformed rank correlations. Journal of the Royal Statistical Society, A 167(Part 2.), 275-294.

See Also

mahalanobis

Examples

1
2

Example output

         1          2          3          4          5          6          7 
 7.2160085  4.3257008  0.8440923  1.5134291  2.0969730  7.7609395 16.0537514 
         8          9         10         11         12         13         14 
12.7285244 13.9153844  5.4796427  6.1669445  8.2130006  8.9678140  1.2510538 
        15         16         17         18         19         20         21 
 6.5831730  2.8194816  2.3046020  5.2032014  2.7992887  2.3844491  2.1648484 
        22         23         24         25         26         27         28 
 3.6412421  1.0753593  1.8880181  1.1136020  0.8451837  1.5872090  2.4596324 
        29         30         31         32         33         34         35 
 5.6991877  4.5959379  5.7128476  8.3101486  5.3993714  4.6988444  5.0190419 
        36         37         38 
 6.4838249  4.8498564  7.2191933 

modi documentation built on May 2, 2019, 6:48 p.m.