On 10/25/12 4:26 PM, Ben Goodrich wrote:
> On Thursday, October 25, 2012 4:19:07 PM UTC-4, Bob Carpenter wrote:
>
> On 10/25/12 4:08 PM, Ben Goodrich wrote:
> > On Thursday, October 25, 2012 3:53:56 PM UTC-4, Bob Carpenter wrote:
> >
> > On 10/25/12 3:18 PM, Ben Goodrich wrote:> You can go with a lot smaller of a guard at zero than e-15. In R,
> > I figured something along those lines. But R is evaluating the same function with more robustness, albeit without
> the
> > transformation or the derivative.
>
> Why do you say that? In Stan, we get:
>
> beta_log(1e-100,0.8,0.8) = 45.635
> beta_log(1e-300,0.8,0.8) = 137.738
> beta_log(1e-323,0.8,0.8) = 148.333
>
> It's the same to 6 decimal places, at least!
>
> It's the gradient that's problematic, not the value.
>
>
> That's what I mean, we can't get the full precision of the function because we have to calculate the gradient.
Stan evaluates the log(beta(x|alpha,beta)) function just fine.
If you provide double-valued inputs, no gradient gets calculated,
and the result is the same as R's (it's a simple function, after
all).
If you use var inputs, you get the right value of the function,
but the gradients will overflow and HMC gets hosed.
Is there something you think we can make better here?
- Bob