prelim.mix: Preliminary Manipulations on Matrix of Incomplete Mixed Data

Description Usage Arguments Value References See Also Examples

View source: R/mix.R

Description

This function performs grouping and sorting operations on a mixed dataset with missing values. It creates a list that is needed for input to em.mix, da.mix, imp.mix, etc.

Usage

1
prelim.mix(x, p)

Arguments

x

data matrix containing missing values. The rows of x correspond to observational units, and the columns to variables. Missing values are denoted by NA. The categorical variables must be in the first p columns of x, and they must be coded with consecutive positive integers starting with 1. For example, a binary variable must be coded as 1,2 rather than 0,1.

p

number of categorical variables in x

Value

a list of twenty-nine (!) components that summarize various features of x after the data have been collapsed, centered, scaled, and sorted by missingness patterns. Components that might be of interest to the user include:

nmis

a vector of length ncol(x) containing the number of missing values for each variable in x.

r

matrix of response indicators showing the missing data patterns in x. Observed values are indicated by 1 and missing values by 0. The row names give the number of observations in each pattern, and the columns correspond to the columns of x.

References

Schafer, J. L. (1996) Analysis of Incomplete Multivariate Data. Chapman \& Hall, Chapter 9.

See Also

em.mix, ecm.mix, da.mix, dabipf.mix, imp.mix, getparam.mix

Examples

1
2
3
4
data(stlouis)
s <- prelim.mix(stlouis, 3)  # do preliminary manipulations 
s$nmis              # look at nmis
s$r                 # look at missing data patterns

Example output

 G D1 D2 R1 V1 R2 V2 
 0 28 28 21 30 16 17 
   G D1 D2 R1 V1 R2 V2
12 1  1  1  1  1  1  1
1  1  0  1  1  1  1  1
8  1  1  0  1  1  1  1
6  1  0  0  1  1  1  1
1  1  1  1  0  1  1  1
1  1  0  1  0  1  1  1
1  1  1  0  0  1  1  1
3  1  0  0  0  1  1  1
3  1  1  1  1  0  1  1
1  1  0  0  1  0  1  1
1  1  1  1  0  0  1  1
6  1  0  1  0  0  1  1
2  1  0  0  0  0  1  1
4  1  1  1  1  1  0  1
1  1  0  1  1  0  0  1
1  1  0  0  0  0  0  1
3  1  1  1  1  0  1  0
1  1  1  1  0  0  1  0
2  1  0  1  0  0  1  0
1  1  0  0  0  0  1  0
1  1  1  0  1  1  0  0
1  1  0  0  1  1  0  0
4  1  1  1  1  0  0  0
2  1  1  0  1  0  0  0
1  1  0  0  1  0  0  0
1  1  0  1  0  0  0  0

mix documentation built on June 20, 2017, 9:13 a.m.