Hi everyone,

I am trying to estimate a latent variable model adapted from chapter 6 of Lee

(2007): Structural Equation Modeling, A Bayesian Approach. The original code

is for WinBUGS, I am trying to convert it to JAGS, but I am running into some

problems with truncation and missing data.

The problem is two-fold: (1) some manifest variables are ordered categorical,

and (2) some observations for these variables are missing. z are the observed

values for the ordinal variables (in the dat.txt file), and Lee uses the

underlying a continuous variable y with a series of thresholds for the ordinal

variables. The WinBUGS truncation trick that is used in the original code goes

something like this:

for(j in 2:2){ y[i,1]~dnorm(mu[i,j],psi[j])I(thd[z[i,j]],thd[z[i,j]+1]) }

The bounds for truncation are chosen from the vector of threshold values thd.

We obviously want to pick different bounds depending on the observed values of

the ordinal variable, which is why we use the indexing trick that you see

above: thd[z+1].

As far as I can tell from the JAGS manual, this should be one of those cases

where it might be enough to substitute-in Ts in the truncation calls.

Unfortunately, this does not work; JAGS stops as soon as it meets a missing

value. Adding 1 to NA (the observed value of z for missing obserations) gives

a non-integer index value:

Error in node z[1,2] Index expression evaluates to non-integer value

Although this model works in OpenBUGS with the usual truncation operator (I),

I was unable to determine exactly what is happening behind the scene with the

index. In any case, I need to run this thing on a cluster that has JAGS

installed and would really like to get this to work with T rather than I. Is

my approach all wrong, or just too simple? Is there a workaround that you

could suggest?

To facilitate diagnostic, here is a link to 4 files: dat.txt, init.txt,

mod.txt, mod.jags.txt & jags.R. mod.txt works out of the box with its data and

init files in OpenBUGS. In mod.jags.txt, I just substituted Is for Ts, and I

am calling JAGS via rjags from the jags.R script.

http://dl.dropbox.com/u/40028/jags-help.rar

Thank you so much for your great work on JAGS and rjags. Working with this

software has made my life a lot easier these past few months. Any help with my

problem would be MUCH appreciated.

Best,

Vincent