Exemplo n.º 1
0
def pdtrc(k, m):
    """Returns sum of right tail of Poisson distribution, k+1 through infinity.

    See Cephes docs for details.
    """
    if k < 0:
        raise ValueError, "Poisson k must be >= 0."
    if m < 0:
        raise ValueError, "Poisson m must be >= 0."
    return igam(k+1, m)
Exemplo n.º 2
0
def chi_low(x, df):
    """Returns left-hand tail of chi-square distribution (0 to x), given df.

    x ranges from 0 to infinity.
    
    df, the degrees of freedom, ranges from 1 to infinity (assume integers).
    Typically, df is (r-1)*(c-1) for a r by c table.
   
    Result ranges from 0 to 1.
    
    See Cephes docs for details.
    """
    x = fix_rounding_error(x)
    if x < 0:
        raise ValueError, "chi_low: x must be >= 0 (got %s)." % x
    if df < 1:
        raise ValueError, "chi_low: df must be >= 1 (got %s)." % df
    return igam(df/2, x/2)
Exemplo n.º 3
0
def gdtr(a, b, x):
    """Returns integral from 0 to x of Gamma distribution with params a and b.
    """
    if x < 0.0:
        return ZeroDivisionError, "x must be at least 0."
    return igam( b, a * x)