1
$\begingroup$

I am trying to estimate the parameters of a uniform distribution, which, by a visual inspection, is between -5 and 25.

I am getting the following error:

"Error in jags.model(filepath, data = list(x = x, N = N), n.chains = 2) : 

   Error in node x[1]

Node inconsistent with parents"

I think the problem is with the .bug file:

model {
for (i in 1:N) {
    x[i] ~ dunif(a, b)
}

a ~ dnorm(-5, .0001)
b ~ dnorm(15,.0001)

}

This code is suppose to estimate "a" and "b", where "x" is uniformly distributed between them.

Any idea why I am getting the error? (Am I even in the right direction?)

$\endgroup$

closed as off-topic by Michael Chernick, jbowman, mdewey, kjetil b halvorsen, Peter Flom - Reinstate Monica Jan 24 '18 at 13:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Michael Chernick, jbowman, mdewey, kjetil b halvorsen, Peter Flom - Reinstate Monica
If this question can be reworded to fit the rules in the help center, please edit the question.

1
$\begingroup$

You don't have a reproducible example but I'm pretty sure I know what is going on. If any of your observations are outside a, b then the likelihood is undefined and you get the error (which must be happening for x[1], it is either less than -5 or greater than 15.

It's really odd to estimate the uniform distribution this way. Just take a and b to be the min(x) and max(x). I don't see the uniform distribution used as likelihood, more often as a prior.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.