Dear all, I generate complete data under Item Response Theory model (3-PL model). Then, I treat missing data depent on motivation variable; ##### generate response data (3PL model) p<-matrix(nrow=n,ncol=I) y<-matrix(nrow=n,ncol=I) for (i in 1:n) { for (j in 1:I) { p[i,j]<-c[j]+(1-c[j])/(1+exp(-1.7*a[j]*(theta[i]-b[j]))) u<-runif(1,0,1) y[i,j]<-ifelse(u<=p[i,j],2,1) } } data<-data.frame(y,theta,mov) data.sort<-data[order(data$mov),] theta.sort<-data.sort$theta y.sort<-data.sort[1:I] ##### generate missing pattern (y1) #### mov.low<-data.sort$mov<mean(mov) num.mov.low<-table(mov.low)[1] y1.miss.low<-y.sort[1:num.mov.low,1] nonmiss.pattern<-rbinom(length(y1.miss),1,1-p.missing) y1.miss.low<-y1.miss.low*nonmiss.pattern for(i in 1:num.mov.low) { ifelse(y1.miss.low[i]==0,y1.miss.low[i]<-NA,y1.miss.low[i]<-y1.miss.low[i]) } y.miss<-y.sort y.miss[1:num.mov.low,1]<-y1.miss.low y.miss<-y.miss-1 y.miss<-data.frame(y.miss) I have problem about outcome equation in Sample Seletion model becuase in this equation my independent variable (latent trait) can not observe. Could you please tell me how to solve this my problem. Thank you very much, Kamontip [[alternative HTML version deleted]]