Relax _gammalogccdf argument types not to be restricted to Float64
I am getting the following error when I am trying to use ForwardDiff with Turing to sample Truncated Poisson distribution.
ERROR: MethodError: no method matching _gammalogccdf(::ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 8}, ::ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 8}, ::ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 8})
Stacktrace:
[1] gammalogccdf(k::Int64, θ::Int64, x::ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 8})
Which suggests that there is a problem with dispatch and perhaps types shouldn't be restricted to Float64.
The function branches on some values and is therefore written specifically for Float64. It would probably be better to introduce a derivative rule for gammalogccdf. In particular when you computing the derivative with respect to x since it's then just -gammapdf(..., x)/gammaccdf(..., x)
That would be great.
@andreasnoack so I tried to add the appropriate rule, but tests for frule and rrule fail.
For the code see https://github.com/JuliaStats/StatsFuns.jl/compare/master...mashu:StatsFuns.jl:master