2

I had a weird problem using JAGS for Bayesian data analysis. Say in a loop, I have

for (i in 1:10) {
   A[i] <- B[i]*exp(-C[i])
}

whenever C[i] is large and results in exp(-C[i]) smaller than 10^-16, A[i] takes the value of A[i-1]. It looks like JAGS cannot handle the small exponential value, but 10^-16 isn't a small number.

athlonshi
  • 1,711
  • 1
  • 19
  • 23
  • 1
    I have a temporary workaround for this problem. Use the log function on both side of the equation and transform the scales. But still, I don't quite get it why the exponential function has a trouble for a number less than 1e-16, which is about exp(-36). – athlonshi Mar 28 '16 at 19:51

0 Answers0