mi.categorical: Elementary function: multinomial log-linear models to impute...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Imputes missing data in a categorical variable using multinomial Log-linear Models.

Usage

1
2
3
4
5
6
  mi.categorical( formula, data = NULL, maxit = 100,
                  MaxNWts = 1500, missing.index = NULL, ...)
  ## S4 method for signature 'mi.categorical'
residuals(object, y)
  ## S4 method for signature '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-linear model is fitted, with coefficients zero for the first class. An offset can be included: it should be a numeric matrix with K columns if the response is either a matrix with K columns or a factor with K > 2 classes, or a numeric vector for a response factor with 2 levels. See the documentation of formula() for other details.

data

A data frame containing the incomplete data and the matrix of the complete predictors.

maxit

Maximum number of iteration.

MaxNWts

The maximum allowable number of weights. See nnet for detail.

missing.index

The index of missing units of the outcome variable

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.

...

Currently not used.

Details

multinom calls the library nnet. See multinom for other details.

Value

model

A summary of the multinomial fitted model.

expected

The expected values estimated by the model.

random

Vector of length n.mis of random predicted values predicted by using the multinomial distribution.

Author(s)

Masanao Yajima yajima@stat.columbia.edu, Yu-Sung Su suyusung@tsinghua.edu.cn, M.Grazia Pittau grazia@stat.columbia.edu, Andrew Gelman gelman@stat.columbia.edu

References

Andrew Gelman and Jennifer Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, Cambridge University Press, 2007.

Yu-Sung Su, Andrew Gelman, Jennifer Hill, Masanao Yajima. (2011). “Multiple Imputation with Diagnostics (mi) in R: Opening Windows into the Black Box”. Journal of Statistical Software 45(2).

See Also

mi.info, mi.method, mi

Examples

1
2
3
4
5
6
7
8
  x <-rnorm(100,0,1)
  y <- x+4
  y <- round(y)
  y[y<0] <- 0
  # create artificial missingness on y
  y[seq(1,100,10)] <- NA
  dat.xy <- data.frame(x,y)
  mi.categorical(formula = y ~ x, data = dat.xy)

mi documentation built on May 2, 2019, 4:43 p.m.

Related to mi.categorical in mi...