예제 #1
0
파일: nh2.py 프로젝트: horta/limix-tool
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)
예제 #2
0
파일: nh2.py 프로젝트: horta/limix-tool
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))
예제 #3
0
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)
예제 #4
0
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))
예제 #5
0
def _mean_truncnorm_rtail(a, mean=0., sd=1.):
    alpha = (a - mean) / sd
    return mean + sd * np.exp(logpdf(alpha) - logsf(alpha))