When fac become too low, error occur and the program stop. I added a sentence and prevent to the fac become zero. I don't know the statistical accuracy of this measure. I am doing so tentatively to get the calculated value.
<>
else {
post1 <- post1 * f$phi[1, t - 1, , ]
post2 <- post2 * f$phi[2, t - 1, , ]
fac <- sum(as.vector(post1)) + sum(as.vector(post2))
smooth[1, t - 1, , ] <- post1/fac
smooth[2, t - 1, , ] <- post2/fac
<>
post1 <- post1 * f$phi[1, t - 1, , ]
post2 <- post2 * f$phi[2, t - 1, , ]
fac <- sum(as.vector(post1)) + sum(as.vector(post2))
if(fac< 1e-200) {
fac <- 1e-200 #added to prevent fac=0 which cause error.
}
smooth[1, t - 1, , ] <- post1/fac
smooth[2, t - 1, , ] <- post2/fac
From Dr. Itoh:
When fac become too low, error occur and the program stop. I added a sentence and prevent to the fac become zero. I don't know the statistical accuracy of this measure. I am doing so tentatively to get the calculated value.
<>
<>