i've been communicating with sharad goel, who wants to use the function below in a Stan program.
functions {
// mean of beta(a,b) conditioned on being larger than x
real beta_conditional_mean(real x, real a, real b) {
return (1 - beta_cdf(x, a+1, b)) / (1 - beta_cdf(x, a, b)) * a / (a+b);
}
}
any tips to make this more numerically stable? i think i'm mainly worried about when a and b are small, but i may be missing something here.
cheers
alp