def E_tl_e_trunc_lower(tg, vare, o): e_mu = 0. ve = np.sqrt(vare) b = o - tg beta = (b - e_mu) / ve return (e_mu - ve * np.exp(logpdf(beta) - logcdf(beta))) * cdf( (o - tg - e_mu) / ve)
def E_tl_e_trunc_upper(tg, vare, o): e_mu = 0. ve = np.sqrt(vare) alpha = (o - tg - e_mu) / ve lambda_ = np.exp(logpdf(alpha) - logsf(alpha)) return (e_mu + ve * lambda_) * np.exp(logsf((o - tg - e_mu) / ve))
def _mean_truncnorm_ltail(b, mean=0., sd=1.): beta = (b - mean) / sd lphi_b = logpdf(beta) lPhi_b = logcdf(beta) return mean - sd * np.exp(lphi_b - lPhi_b)
def _var_truncnorm_rtail(a, mean=0., sd=1.): alpha = (a - mean) / sd lphi_a = logpdf(alpha) lambda_ = np.exp(lphi_a - logsf(alpha)) return sd * sd * (1.0 - lambda_ * (lambda_ - alpha))
def _mean_truncnorm_rtail(a, mean=0., sd=1.): alpha = (a - mean) / sd return mean + sd * np.exp(logpdf(alpha) - logsf(alpha))