[R] help with multiple imputation using imp.mix

Jens Hainmueller jens_hainmueller at ksg05.harvard.edu
Thu Dec 16 01:50:48 CET 2004


I am desperately trying to impute missing data using 'imp.mix' but always
run into this yucky error message to which I cannot find the solution. It's
the first time I am using mix and I'm trying really hard to understand, but
there's just this one step I don't get...perhaps someone knows the answer?

Thanks!
Jens

My code runs:

data<-read.table('http://www.courses.fas.harvard.edu/~gov2001/Data/immigrati
on.dat',header=TRUE)
library(mix)
rngseed(12345678)
# Preare data for imputation
gender1<-c()
 gender1<-as.integer(data$gender)
 gender1[gender1==1]<-2
 gender1[gender1==0]<-1
 data$gender<-gender1
x<-cbind(data$gender,data$ipip,data$ideol,data$prtyid, data$wage1992)
colnames(x)<-c("gender","ipip", "ideol", "prtyid","wage")
# start imputation
s <- prelim.mix(x,4)
thetahat <- em.mix(s)

And here comes the error message:

> newtheta <- da.mix(s,thetahat, steps=100,showits=TRUE)
Steps of Data Augmentation:
1...Error in da.mix(s, thetahat, steps = 100, showits = TRUE) :
        Improper posterior--empty cells
> imp.mix(s, newtheta, x)




More information about the R-help mailing list