math icon indicating copy to clipboard operation
math copied to clipboard

update weibull lcdf/cdf to handle 0 as an input

Open spinkney opened this issue 3 years ago • 0 comments

Description

Weibull (l)cdf errors when the input value == 0 although this value is valid. The issue is that the gradient for alpha needs special handling when the input is 0. Furthermore, it is naively calculating log(1 - exp(x)) at https://github.com/stan-dev/math/blob/15f1348c8b07964ff032ebf1271d5ab26360c332/stan/math/prim/prob/weibull_lcdf.hpp#L71. It's fairly easy to update to use log1m_exp and seems to solve some issues raised in the Discourse question https://discourse.mc-stan.org/t/interval-censored-data-fails-with-weibull-but-not-gamma/28780/2?u=spinkney.

spinkney avatar Sep 08 '22 18:09 spinkney