Hi all,
I am using rstan and in one of my functions, I have the following code, where B is a 4x4 matrix.
The idea is that I am summing over 16 different combinations of values.
n=B[1,1];
ll = log(sum(exp(B-n))/16)+n;
return(ll);
What would happen if at some point, the entries of the matrix have very different values, i.e., ranging from 100 to 4000? Then, the exponential of a very high number would potentially give infinity, right?
Depending on the initial values, this does not necessarily result in an error of `` Log probability evaluates to log(0), i.e. negative infinity.āā.
Hence, would I realize that there is a problem? Or is this even a problem?
Iām happy about ideas about how to deal with this.