Пример #1
0
def normal_lccdf(mu, sigma, x):
    z = (x - mu) / sigma
    return tt.switch(
        tt.gt(z, 1.0),
        tt.log(tt.erfcx(z / tt.sqrt(2.)) / 2.) - tt.sqr(z) / 2.,
        tt.log1p(-tt.erfc(-z / tt.sqrt(2.)) / 2.)
    )
Пример #2
0
def normal_lccdf(mu, sigma, x):
    z = (x - mu) / sigma
    return tt.switch(
        tt.gt(z, 1.0),
        tt.log(tt.erfcx(z / tt.sqrt(2.0)) / 2.0) - tt.sqr(z) / 2.0,
        tt.log1p(-tt.erfc(-z / tt.sqrt(2.0)) / 2.0),
    )
Пример #3
0
def normal_lcdf(mu, sigma, x):
    z = (x - mu) / sigma
    return tt.switch(
        tt.lt(z, -1.0),
        tt.log(tt.erfcx(-z / tt.sqrt(2.)) / 2.) - tt.sqr(z) / 2,
        tt.log1p(-tt.erfc(z / tt.sqrt(2.)) / 2.)
    )
Пример #4
0
def normal_lcdf(mu, sigma, x):
    """Compute the log of the cumulative density function of the normal."""
    z = (x - mu) / sigma
    return tt.switch(
        tt.lt(z, -1.0),
        tt.log(tt.erfcx(-z / tt.sqrt(2.0)) / 2.0) - tt.sqr(z) / 2.0,
        tt.log1p(-tt.erfc(z / tt.sqrt(2.0)) / 2.0),
    )
Пример #5
0
def normal_lcdf(mu, sigma, x):
    """Compute the log of the cumulative density function of the normal."""
    z = (x - mu) / sigma
    return tt.switch(
        tt.lt(z, -1.0),
        tt.log(tt.erfcx(-z / tt.sqrt(2.)) / 2.) - tt.sqr(z) / 2.,
        tt.log1p(-tt.erfc(z / tt.sqrt(2.)) / 2.)
    )
def invprobit(x):
    return .5 * erfc(-x / sqrt(2.))
Пример #7
0
def phi(x):
    return 0.5 * (tt.erfc(-x / tt.sqrt(2)))
Пример #8
0
def invprobit(x):
    return 0.5 * erfc(-x / sqrt(2))
Пример #9
0
def invprobit(x):
    return .5 * erfc(-x / sqrt(2.))
def cdf(mu, sd, value):
    z = zvalue(value, mu=mu, sd=sd)
    return tt.erfc(-z / tt.sqrt(2.)) / 2.
Пример #11
0
def invprobit(x):
    return 0.5 * erfc(-x / sqrt(2))
Пример #12
0
def logp_emg_weighted(x, mu, sigma, lamb, weighted):
    inner_erfc = (mu + lamb * (sigma ** 2) - x) / (np.sqrt(2) * sigma)
    return (
        1
        / weighted
        * (tt.log(lamb / 2) + (lamb / 2) * (2 * mu + lamb * (sigma ** 2) - 2 * x) + tt.log(tt.erfc(inner_erfc)))
    )
Пример #13
0
def logp_emg(x, mu, sigma, lamb):
    inner_erfc = (mu + lamb * (sigma ** 2) - x) / (np.sqrt(2) * sigma)
    return tt.log(lamb / 2) + (lamb / 2) * (2 * mu + lamb * (sigma ** 2) - 2 * x) + tt.log(tt.erfc(inner_erfc))
Пример #14
0
def s_normal_logcdf(x, mean, var):
    z = (x - mean) / TT.sqrt(var)
    return TT.log(.5) + TT.log(TT.erfc(-z / np.sqrt(2)))
Пример #15
0
def s_normal_cdf(x, mean, var):
    z = (x - mean) / TT.sqrt(var)
    return .5 * TT.erfc(-z / np.sqrt(2))
Пример #16
0
def cdf(sample, location=0, var=1):
    z = (sample - location) / T.sqrt(var)
    return .5 * (T.erfc(-z / SQRT2))