Hi all,

I am trying to estimate an adjacent category logit model. For a quick review, see https://onlinecourses.science.psu.edu/stat504/node/175. I used rjags package in R to estimate the model. I was successful using the model codes at the very end of this email with one data file. But when I switched to another data file, it didn't work any more.

For the second data file, I got the error message saying that

"Error: Error in node pr[74,1]

Invalid parent values"

In addition, every time after I rerun the codes with the second data file, the node with the error also changes, but it's always about pr[i,1]; that is, the probability of one for some case. I checked the line in the model state related to pr[i,1], and I don't see any inappropriate priors, such as a normal prior for a precision parameter. But maybe I missed something here. For both sets of data, each has a different ordered response variable, ranging from one to four, and each has a different set of independent variables. None of the data sets have missing values. YOu can click the link below this paragraph to download my r script and the two data sets (in Stata format) to reproduce the results and the error. The one data file that worked is gssCum7212BayesOrdSample200.dta (the dependent variable is health) and the other one that didn't work is issp2005Sample200.dta (its dependent variable is worryjob). I sampled from the original data so that the sample sizes are small enough for a quick rerun of my model and data. I just cannot figure out any reason why the codes only worked with some but not other similar data.

link to my r script and data:

https://drive.google.com/folderview?id=0Bw7yz4yKob9XVzdrZm5EeG5ESTA&usp=sharing

Note that you need to change the directory/file name in the r script to run the model off the two data sets. You don't need to change anything else.

model { for( i in 1 : nData ) { y[i] ~ dcat( pr[i,1:nYlevels] ) pr[i,nYlevels] <- 1/denom[i] pr[i,3] <- exp(thresh[3]-mu[i])/denom[i] pr[i,2] <- exp(thresh[3]-mu[i])*exp(thresh[2]-mu[i])/denom[i] pr[i,1] <- exp(thresh[3]-mu[i])*exp(thresh[2]-mu[i])*exp(thresh[1]-mu[i])/denom[i] denom[i] <- exp(thresh[3]-mu[i])*exp(thresh[2]-mu[i])*exp(thresh[1]-mu[i]) + exp(thresh[3]-mu[i])*exp(thresh[2]-mu[i]) + exp(thresh[3]-mu[i]) mu[i] <- inprod( b[1:nPredictors] , x[i,1:nPredictors] ) } # bPrec <- pow( nYlevels/4 , -2 ) # max plausible slope is 1SD for ( j in 1:nPredictors ) { b[j] ~ dnorm(0, 0.001) # modest precision because of normalized x,y values } # threshPriorPrec <- 1 for ( k in 1:(nYlevels-1) ) { threshPriorMean[k] <- k+0.5 thresh[k] ~ dnorm( threshPriorMean[k] , 0.001) } }