mi.categorical: Elementary function: multinomial log-linear models to impute a categorical variable.
Description
Imputes missing data in a categorical variable using multinomial Log-linear Models.
Usage
mi.categorical( formula, data = NULL, n.iter = 100, MaxNWts = 1500, ...)
## S3 method for class 'mi.categorical':
residuals(object, y)
## S3 method for class 'mi.categorical,ANY':
plot( x, y, main=deparse( substitute( y ) ), gray.scale = FALSE, ...)
Arguments
formula
a formula expression as for regression models, of the form
response ~ predictors. The response should be a factor or a
matrix with K columns, which will be interpreted as counts
for each of K classes. A log-li
data
A data frame containing the incomplete data and the matrix of the complete predictors.
n.iter
Maximum number of iteration.
MaxNWts
The maximum allowable number of weights. See nnet for detail.
...
Currently not used.
object
mi.categorical object.
x
mi.categorical object.
y
Observed values.
main
main title of the plot.
gray.scale
When set to TRUE, makes the plot into gray scale with predefined color and line type.
Value
modelA summary of the multinomial fitted model.
expectedThe expected values estimated by the model.
randomVector of length n.mis of random predicted values predicted by using the multinomial distribution.
Details
multinom calls the library nnet. See multinom for other details.
References
Andrew Gelman and Jennifer Hill,
Data Analysis Using Regression and Multilevel/Hierarchical Models,
Cambridge University Press, 2007.