Learn R Programming

BaBooN (version 0.2-0)

dmi: Data monotonicity index for missing values

Description

‘dmi’ calculates a monotonicity index for data with missing values.

Usage

dmi(Data)

Arguments

Data
A data frame containing missing values.

Value

Returns a value between 1 (fully monotone) and 0 (no monotonicity).

Details

The data monotonicity index examines the ratio of missing values with non-monotonicity and complete monotonicity in all variables. To denote full monotonicity with 1 and no monotonicity with 0 this ratio is subtracted from 1.

$$dmi = 1-\frac{\sum_{j=1}^{p}\sum_{i=1}^{n-\sum_{h=1}^{n}I(r_{hj}=0)} \sum_{h=1}^{n} I (r_{hi}=0)}{\sum_{h=1}^{n}\sum_{j=1}^{p} I(r_{hj}=0)}$$

References

Harrell, F.E., with contributions from Charles Dupont and many others. (2013) Hmisc: Harrell Miscellaneous. R package version 3.13-0. http://CRAN.R-project.org/package=Hmisc Venables, W. N. & Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth Edition. Springer, New York. ISBN 0-387-95457-0 Ported to R by Alvaro A. Novo. Original by Joseph L. Schafer . (2013). norm: Analysis of multivariate normal datasets with missing values. R package version 1.0-9.5. http://CRAN.R-project.org/package=norm

See Also

BBPMM, prelim.norm

Examples

Run this code

if(!require(MASS)) install.packages("MASS")
library(MASS)  ## see references
data(survey)

## Sorting via 'norm's prelim.norm
if(!require(Hmisc)) install.packages("Hmisc")
library(Hmisc) ## see references
survey.numeric <- asNumericMatrix(survey)

if(!require(norm)) install.packages("norm")
library(norm) ## see references
su.sort    <- prelim.norm(survey.numeric)
new.survey <- survey[order(su.sort$ro),
                     sort(su.sort$nmis,index.return=TRUE)$ix]

## Comparison
dmi(survey)     # original
dmi(new.survey) # sorted


Run the code above in your browser using DataLab