0

I'm trying to do one-way ANOVA on uncertain (latent) input value YReal[i] (each input value is not exactly known, but it is given as normal distribution with mean Y[i] and standard deviation SE[i]). But, I got stuck. I tried the following model:

model {

# likelihood
for (i in 1:N) {
    YReal[i] ~ dnorm(alpha[group[i]], eps_tau) # one-way ANOVA expression
    YReal[i] ~ dnorm(Y[i], 1/(SE[i]*SE[i])) # uncertainty of the input value
}

# priors

eps_tau ~ dgamma(0.01, 0.01)
eps_sigma <- 1 / sqrt(eps_tau)

for (j in 1:no_group) {
    alpha[j] ~ dnorm(0, 0.0001)
}

}

but I got message from jags

Attempt to redefine node YReal[1]

I tried to rewrite the model as

YReal[i] <- alpha[group[i]] + eps[i]
eps[i] ~ dnorm(0, eps_tau)
YReal[i] ~ dnorm(Y[i], 1/(SE[i]*SE[i]))

or

eps[i] <- YReal[i] - alpha[group[i]]
eps[i] ~ dnorm(0, eps_tau)
YReal[i] ~ dnorm(Y[i], 1/(SE[i]*SE[i]))

But I got the same error. Is there any bayesian tool or trick how to get around that and achieve the goal? Thanks.

P.S.: I tried this:

YReal[i] ~ dnorm(alpha[group[i]], eps_tau)
Y[i] ~ dnorm(YReal[i], 1/(SE[i]*SE[i]))

but I'm not even remotely sure it is equivalent to the original model (and that it does what I need)

Tomas
  • 5,735
  • 11
  • 52
  • 93
  • @DirkEddelbuettel, do you have any thoughts? – Tomas Oct 15 '12 at 15:24
  • The error message is clear: within your loop you define `YReal[i]` twice for each $i$; this first happens when $i=1$. The software is protecting you against that obvious contradiction. – whuber Oct 15 '12 at 15:48
  • @whuber, yes, I know why I got that message. I'm asking for a solution, how to get around that. And, by the way, there is no "contradiction" on the "logical" level, it is only limitation of the software. On the logical level, both statements are clearly true for variable `YReal[i]`. – Tomas Oct 15 '12 at 15:57
  • Really? I don't see how it is possible to draw two random variates from distributions with two different sets of parameters and guarantee those variates will always be equal. And because you haven't really told us what you're trying to do--you are relying on non-working code for that and "ANOVA" is a pretty vague description--it's hard to figure out what a valid solution would be. – whuber Oct 15 '12 at 16:04
  • 1) What I'm trying to do is described in 1st sentence, if you need clarification, you can ask 2) "I don't see how it is possible to draw..." - don't think procedurally as a computer program. On logical level, those statements are not draws, but statements about those variables. – Tomas Oct 15 '12 at 16:24
  • (1) I asked. It's fine if you have constraints preventing you from disclosing any more information, but please be aware that is likely to limit the scope and quality of answers you can expect. (2) On an *implementation* level they will be draws. But let's ignore that: conceptually, you are asserting that `Y[i]` and `alpha[group[i]]` are *identical* and that `1/(SE[i]*SE[i])` and `eps_tau` are *identical*. Neither I nor, evidently, the software itself can find any evidence that assures this. Might I suggest that the first step in a solution would be to clarify *conceptually* what your model is? – whuber Oct 15 '12 at 16:28
  • I've updated the question. Is it more clear now? P.S.: I didn't really understood what you were asking - when you state that "ANOVA" is a pretty vague description... I thought one-way ANOVA would be clear to anyone... – Tomas Oct 16 '12 at 09:32
  • It would be clear to people who are familiar with only one kind of ANOVA :-). I am being cautious because ANOVA is so straightforward and efficient to implement, I wonder why anyone would be using BUGS to fit it. This makes me suspect you intend later to develop your approach into something a little different than shown here, something that might qualify as a version of ANOVA but uses (say) different distributional assumptions. – whuber Oct 16 '12 at 15:36
  • Well, this is just an attempt to say that the input values are not observation, not certain values, but rather some uncertain values given as normal distribution instead. – Tomas Oct 16 '12 at 15:45

0 Answers0