Bob Carpenter
unread,Sep 14, 2012, 4:51:38 PM9/14/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to stan...@googlegroups.com
What are we going to implement for the CDFs?
Just literally implementing the cdfs is dangerous
in terms of numerical precision.
I see four functions that make sense on their own:
foo_cdf(y,...)
foo_cdf_log(y,...) = log(foo_cdf(y,...))
foo_ccdf(y,...) = 1 - foo_cdf(y,...)
foo_ccdf_log(y,...) = log(1 - foo_cdf(y,...))
There are numerical stability issues with trying
to calculate the log values directly or calculate
a ccdf by subtracting a cdf.
In truncated distributions, we also need to evaluate
distributions bounded above and below in (L,U) with
foo_truncate_lu(U,L,...) = - log(foo_cdf(U,...) - foo_cdf(L,...))
= - log_sum_exp(foo_cdf_log(U,...),
0,
foo_ccdf_log(L,...))
The one-sided bounds both reduce to one of the above.
To bound above by U,
foo_truncate_u(U,...) = - log(foo_cdf(U,...) - 0)
= - foo_cdf_log(U,...)
and to bound below by L,
foo_truncate_l(L,...) = - log(1 - foo_cdf(L,...))
= - foo_ccdf_log(L,...)
Of course, we also need gradients of all these functions,
which means either calculating them directly or implementing
in terms of functions that can be auto-diffed.
- Bob