prelim.cat {cat} | R Documentation |
Preliminary manipulations on incomplete categorical data
Description
This function performs grouping and sorting operations on categorical datasets with missing values. It creates a list that is needed for input to em.cat, da.cat, imp.cat, etc.
Usage
prelim.cat(x, counts, levs)
Arguments
x |
categorical data matrix containing missing values. The data may be
provided either in ungrouped or grouped format. In ungrouped format,
the rows of x correspond to individual observational units, so that
nrow(x) is the total sample size. In grouped format, the rows of x
correspond to distinct covariate patterns; the frequencies are
provided through the |
counts |
optional vector of length |
levs |
optional vector of length |
Value
a list of seventeen components that summarize various features of x after the data have been sorted by missingness patterns and grouped according to the observed values. Components that might be of interest to the user include:
nmis |
a vector of length |
r |
matrix of response indicators showing the missing data patterns in x. Dimension is (m,p) where m is number of distinct missingness patterns in the rows of x, and p is the number of columns 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. |
d |
vector of length |
ncells |
number of cells in the cross-classified contingency table, equal to
|
References
Chapters 7–8 of Schafer (1996) Analysis of Incomplete Multivariate Data. Chapman & Hall.
See Also
em.cat
, ecm.cat
, da.cat
,mda.cat
, dabipf
, imp.cat
Examples
data(crimes)
crimes
s <- prelim.cat(crimes[,1:2],crimes[,3]) # preliminary manipulations
s$nmis # see number of missing observations per variable
s$r # look at missing data patterns