I’m writing a model which uses a Gamma distributed RV. I compute the cdf of the RV, and use this to perform later computation. When I want to perform sampling, I get errors which state that the derivative of the logcdf function is not available.
Is there a way I can implement this? The derivative of the CDF is available in closed form (since it is pdf of the Gamma distribution, so I thought this should be easy to implement?
Which is the reason for this question - this error makes me think that the derivative of the logcdf here is not setup. Maybe I’ve done something else wrong instead?
I ran into the same issue. I needed to use logcdf to implement a model with left censored data. A convenience function for something like gamma_lcdf hasn’t been implemented yet, so I wanted to use logcdf rather than write my own, but encountered this problem.
Edit: Adding a little more detail.
I wanted to implement a censored model with pm.Potential, as is generally recommended. I was looking to implement something convenient like:
But encountered the same error of gradient being undefined. I believe gradient is only being used for NUTS sampling. If I set step=pm.Metropolis() like I might have to do if I were dealing with a likelihood that is not differentiable, then I can sample and nothing breaks. I’d just prefer to use NUTS while sampling for obvious reasons.