Node inconsistent with parents in JAGS model (R)

The dbern distribution expects response in {0,1} rather than {1,2} as it seems you have coded it, so you need to subtract 1 from your values of y.

It is a bit strange that you get this error, as dbern does not usually give an error for other response values (it basically makes <0 = 0 and >1 = 1). The error is probably stemming from the fact that the response is fitting all the same value, but if that doesn’t fix it then you could try the following:

1) Try increasing the precision of your priors for a/b/c/d slightly – a variance of 10^12 is quite a lot

2) Instead of:

mu[i] <- 1/(1+exp(-(a + b*HLL[i] + c*LHL[i] + d*LLL[i])))

You could write:

logit(mu[i]) <- -(a + b*HLL[i] + c*LHL[i] + d*LLL[i])

This might also help JAGS to recognise this as a GLM and initiate the appropriate samplers – remember to load the glm module.

3) Set some initial values for a/b/c/d that are vaguely consistent with your data (perhaps obtained using a fit with glm() in R)

Leave a Comment