| imp.cat | R Documentation |
Performs single random imputation of missing values in a categorical dataset under a user-supplied value of the underlying cell probabilities.
imp.cat(s, theta)
s |
summary list of an incomplete categorical dataset created by the
function |
theta |
parameter value under which the missing data are to be imputed.
This is an array of cell probabilities of dimension |
Missing data are drawn independently for each observational unit from
their conditional predictive distribution given the observed data and
theta.
If the original incomplete dataset was in ungrouped format
(s$grouped=F), then a matrix like s$x except that all NAs have
been filled in.
If the original dataset was grouped, then a list with the following components:
x |
Matrix of levels for categorical variables |
counts |
vector of length |
IMPORTANT: The random number generator seed must be set by the
function rngseed at least once in the current session before this
function can be used.
prelim.cat, rngseed, em.cat, da.cat, mda.cat, ecm.cat,
dabipf
data(crimes)
x <- crimes[,-3]
counts <- crimes[,3]
s <- prelim.cat(x,counts) # preliminary manipulations
thetahat <- em.cat(s) # find ML estimate under saturated model
rngseed(7817) # set random number generator seed
theta <- da.cat(s,thetahat,50) # take 50 steps from MLE
ximp <- imp.cat(s,theta) # impute once under theta
theta <- da.cat(s,theta,50) # take another 50 steps
ximp <- imp.cat(s,theta) # impute again under new theta
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.