0
$\begingroup$

Suppose we have the following model for the difference in two proportions from a binomial.

rjagsmod ="model {
for(i in 1:N) 
{
    x0[i] ~ dbin(theta0[i],n0[i]);
    x1[i] ~ dbin(theta1[i],n1[i]);
    theta0[i] ~ dunif(0,1);
    theta1[i] <- theta0[i]+diff[i];
    diff[i] ~ dnorm(mu,precision);
}
mu ~ dnorm(0, 1);
var ~ dunif(0,4);
precision <- 1/var;
}
"

In this model, the difference diff is constrained to be from -1 to 1 by definition of probabilities. However, we see that we modeled it by a normal distribution with mean from a normal, and variance on a uniform from 0 to 4. Hence, it is entirely possible that some draws of diff are outside -1 to 1.

A situation is if mu was drawn to be 1. Then regardless of the var or precision, we have a 50% chance of getting something outside the range of diff. How exactly does RJags deal with this? Do they just throw away values outside of what might be the constraint? The first constraint I imagine RJags might see is that both thetas come form a binomial, with the second constraint being theta1[i] <- theta0[i]+diff[i].

I did test making it even more extreme by letting mu ~ dnorm(1,1). In this case, RJags gave me an error "Invalid parent values", but why did it not throw errors when I did the more conservative case above?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.