種の識別といいますか,
どの種であるかも同時に判別しなさい
(教師あり学習) という問題だと,
BUGS code は下のごとく複雑怪奇なものになる.
ここでは "対数(タテヨコ比)" の世界で判別をやらせてみた.
Y[i] ~ dnorm(y[i], Tau.err)
X[i] ~ dnorm(x[i], Tau.err)
y[i] <- unit.length[i] * sqrt(rxy[i])
x[i] <- unit.length[i] / sqrt(rxy[i])
rxy[i] <- exp(log.rxy[i])
log.rxy[i] ~ dnorm(mean.log.rxy[i, spc[i]], tau[spc[i]])
for (s in 1:N.spc) {
mean.log.rxy[i, s] <- (
bs[1, s]
+ bs[2, s] * (unit.length[i] - Mean.ul)
)
}
unit.length[i] <- exp(log.unit.length[i])
log.unit.length[i] ~ dnorm(0, Tau.noninformative)
# spc
spc[i] ~ dcat(q[i,])
Spc[i] ~ dcat(q[i,])
q[i, 1] <- v[i, 1] * w[1] / total.v[i]
q[i, 2] <- v[i, 2] * w[2] / total.v[i]
q[i, 3] <- v[i, 3] / total.v[i]
total.v[i] <- v[i, 1] * w[1] + v[i, 2] * w[2] + v[i, 3]
for (s in 1:N.spc) {
v[i, s] <- exp(
-pow(log.rxy[i] - mean.log.rxy[i, s], 2) * tau[s] * 0.5
) / sigma[s]
}