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)