Dear,

Hope you all had a wonderful break. I am working on a Bayesian model that involves missing data. What I want to do in the BUGS/JAGS code is to model some missing data (an x variable), and then create two dummies for say 50 and 75 percentiles of that variable with imputed missing and put them into the main model. But I haven't been able to find ways to compute these two percentiles of the covariate with missing. Here are some model codes that I have been experimenting with:

for( i in 1 : nData ) { y[i] ~ dbern(mu[i]) logit(mu[i]) <- b0[Group[i]] + b1*x1[i] + b2*x2 + b3[countryR[i]]*x3dum[i] } for( i in 1: nData) { x3[i] ~ dnorm(x3.mu[i], x3.tau) x3.mu[i] <- g0[Group[i]] + g1*x1[i] } for (i in 1: nData) { x3dum[i] <- ifelse(x3.mu[i] > mean(x3[]), 1, 0) }

Note that the x variable with missing is x3 and is modeled in the second loop. Then I create a dummy variable based off the mean of x3 in the third loop, which is fed back to the first loop. But here the dummy is created using mean as the threshold. What if I want to use some percentile of x3 as the benchmark for creating dummy? Is this the right way? Should I use the data step block? Any help would be appreciated.

Jun Xu, PhD

Department of Sociology

Ball State University

Muncie, IN 47306