mi.mixed {mi} | R Documentation |
Imputes univariate missing data using a two stage imputation process. The first regression model is fit to all the data for which the variable is observed, and the second model is fit to all the data for which the variable is observed and positive.
mi.mixed(formula, data = NULL, start = NULL, n.iter = 100, draw.from.beta = FALSE, ...) ## S3 method for class 'mi.mixed': coef(object, ...) ## S4 method for signature 'mi.mixed': sigma.hat(object, ...) ## S3 method for class 'mi.mixed': fitted(object, ...) ## S3 method for class 'mi.mixed': residuals(object, y, ...) ## S4 method for signature 'mi.mixed': imputed(object, y) ## S3 method for class 'mi.mixed': plot(x, y, main=deparse( substitute( y ) ), gray.scale = FALSE, ...)
formula |
an object of class '"formula"' (or one that can be coerced to that class): a symbolic description of the model to be fitted. See bayesglm 'formula' for details. |
data |
A data frame containing the incomplete data and the matrix of the complete predictors. |
start |
Starting value for bayesglm. |
n.iter |
Maximum number of iteration for bayesglm. The default is 100. |
draw.from.beta |
Draws from posterior distribution of the betas to add randomness. |
... |
Currently not used. |
object |
mi.mixed object. |
x |
mi.mixed 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. |
Imputation variable that can be positive or zero. See Gelman and Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, (2206), Chapter 25.
model$model.1 |
A summary of the fitted model for the all the data for which y is observed. |
model$model.2 |
A summary of the fitted model for the all the data for which y is observed and positive. |
expected |
The expected values estimated by the model |
random |
Vector of length n.mis of random predicted values to impute the missing data. Whether missing values are positive random is positive, otherwise is equal to zero. |
Masanao Yajima yajima@stat.columbia.edu, M.Grazia Pittau grazia@stat.columbia.edu, Andrew Gelman gelman@stat.columbia.edu
Andrew Gelman and Jennifer Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, Cambridge University Press, 2007.
# true data x<-rnorm(100,0,1) # N(0,1) y<-rnorm(100,(1+2*x),1.2) # y ~ 1 + 2*x + N(0,1.2) y[y<0]<-0 # create artificial missingness on y y[seq(1,100,10)]<-NA dat.xy <- data.frame(x,y) # imputation mi.mixed(list("1*(y>0)~x","y~x"), data = dat.xy)