def prior_triangle(x, triangle_params):
    """ Triangle prior distribution

    Parameters
    ----------
    x: float
        Parameter value whos likelihood we want to test.
    triangle_params: tuple
        Tuple containg lower bound, upper bound and mode of the triangle distribution.

    Returns
    -------
    Log likelihood of sample x in light of a triangle prior distribution.

    """
    low, high, mode = triangle_params
    return triang.logpdf(x, loc=low, scale=high, c=mode)
Exemple #2
0
def tri_logdensity(x, min, max, mode):
    loc = float(min)
    scale = float(max) - float(min)
    c = (float(mode) - float(min)) / float(scale)
    log_density = triang.logpdf(x=x, c=c, loc=loc, scale=scale)
    return log_density
Exemple #3
0
def tri_logdensity(x, min, max, mode):
    loc = float(min)
    scale = float(max) - float(min)
    c = (float(mode) - float(min))/float(scale)
    log_density = triang.logpdf(x = x, c = c, loc = loc, scale = scale)
    return log_density