# Censoring/Truncation in JAGS

I have a question on how to fit a censoring problem in JAGS.

I observe a bivariate mixture normal where the X values have measurement error. I would like to model the true underlying 'means' of the observed censored values.

\begin{align*} \lceil x_{true}+\epsilon \rceil = x_{observed} \ \epsilon \sim N(0,sd=.5) \end{align*}

Here is what I have now:

 for (i in 1:n){
x[i,1:2]~dmnorm(mu[z[i],1:2], tau[z[i],1:2,1:2])
z[i]~dcat(prob[ ])
}


Y also has measurement error. What I want to do is something like this:

 for (i in 1:n){
x_obs[i] ~ dnorm(x_true[i],prec_x)I(x_true[i],)
y_obs[i] ~ dnorm(y_true[i],prec_y)
c(x_true[i]:y_true[i])~dmnorm(mu[ z [ i ],1:2], tau[z[i],1:2,1:2])
z[i]~dcat(prob[ ])
}

#priors for measurement error
e_x~dunif(.1,.9)
prec_x<-1/pow(e_x,2)
e_y~dunif(2,4)
prec_y<-1/pow(e_y,2)


Obviously the c command is not valid in JAGS.

• To truncate, use T(-,-), but read the users manual for info on censuring and truncationq – David LeBauer Feb 4 '11 at 4:06

Perhaps this is what you are looking for:

x_obs[i] ~ dnorm(x_true[i],prec_x)T(x_true[i], )


JAGS has options for both censoring and truncation. It sounds like you want truncation, since you know a-priori that the observation lies within a particular range

Read the user's manual for more details about how jags uses truncation and censoring.

Thanks for the tips David. I posted this question on the JAGS support forum and got a useful answer. The key was to use a two dimensional array for the 'true' values.

for (j in 1:n){
x_obs[j] ~ dnorm(xy_true[j,1], prec_x)T(xy_true[j,1],)
y_obs[j] ~ dnorm(xy_true[j,2], prec_y)
xy_true[j, ] ~ dmnorm(mu[ z [j],1:2], tau[z[j],1:2,1:2])
z[j]~dcat(prob[ ])
}

#priors for measurement error
e_x~dunif(.1,.9)
prec_x<-1/pow(e_x,2)
e_y~dunif(2,4)
prec_y<-1/pow(e_y,2)