r - log(0^0) gives 0 but 0*log(0) gives NaN -
when working loglikelihoods, somethink like:
alpha*log(x) # log version of log(x^alpha) in non-log case, if both x , alpha zero, r assumes 0^0 =1, desired behavior (e.g.: scenario "zero observations had 0 probability" has probability 1). in alpha*log(x) version gives nan:
alpha <- 0 x <- 0 log(x^alpha) # gives 0 alpha*log(x) # gives nan i've read 0*inf = nan ieee standard, supposed then? creating particular case alpha=0? not working logs in case? else?
i guess common scenario , wonder how other people deal or whether there common practice that.
r completes algebraic methods in steps, these steps
log(0^0) = log(1) = 0
0 * log(0) = 0 * inf = ?
Comments
Post a Comment