I've been looking at the deviance calculation for negative binomial model in H2O ( code line 580/959) and I'm struggling to reason why it is 0 when yr or ym is/are 0.
(yr==0||ym==0)?0:2*((_invTheta+yr)*Math.log((1+_theta*ym)/(1+_theta*yr))+yr*Math.log(yr/ym))
The formula for the deviance calculation is as below (from H2O Documentation ):
Going with maths, I don't see the deviance is 0 unless both yr and ym are 0.
Does anyone happen to know if there is a special case where deviance for negative binomial needs to be set to 0 when either of the yr and ym is/are 0?
Thanks!
I'm not sure, but it seems to me they maybe just chose the lazy way out of a numerical difficulty.
mu=0
( ym
) is a degenerate case where p=0
and so y=0
always. It's not interesting, and not really part of any useful analysis. I'm not sure it can even come out with the linear-predictor. With using the natural parameter = linear predictor, you need the linear predictor to be equal to minus infinity...
However, y
can be equal to 0
for other mu
's. And what you do in this case, is take the limit of the deviance as y->0
, which is completely defined for Negative-Binomial, and isn't equal to 0. They could have implemented it, but chose not too, so this is why I call it "lazy".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.