Esempio n. 1
0
 def cdf(self, val):
     if isinstance(val, (float, int)):
         if val < self.minimum:
             _cdf = 0.
         else:
             _cdf = gammainc(self.k, val / self.theta)
     else:
         _cdf = np.zeros(val.size)
         _cdf[val >= self.minimum] = gammainc(self.k, val[val >= self.minimum] / self.theta)
     return _cdf
Esempio n. 2
0
def chisquare_solve(XGUESS, P, V):
    PGUESS = gammainc(V / 2, V * XGUESS / 2)  # incomplete Gamma function

    PDIFF = np.abs(PGUESS - P)  # error in calculated P

    TOL = 1E-4
    if PGUESS >= 1 - TOL:  # if P is very close to 1 (i.e. a bad guess)
        PDIFF = XGUESS  # then just assign some big number like XGUESS

    return PDIFF
def chisquare_solve(XGUESS,P,V):

	PGUESS = gammainc(V/2, V*XGUESS/2)  # incomplete Gamma function

	PDIFF = np.abs(PGUESS - P)            # error in calculated P

	TOL = 1E-4
	if PGUESS >= 1-TOL:  # if P is very close to 1 (i.e. a bad guess)
		PDIFF = XGUESS   # then just assign some big number like XGUESS

	return PDIFF
Esempio n. 4
0
def chisquare_solve(xguess, p, v):
    """
    Chisqure_solve
    
    Return the difference between calculated percentile and P.
    
    Written January 1998 by C. Torrence
    """
    pguess = gammainc(v / 2, v * xguess / 2)
    pdiff = np.abs(pguess - p)
    if pguess >= 1 - 1e-4:
        pdiff = xguess
    return pdiff
Esempio n. 5
0
def chisquare_solve(xguess,p,v):
    """
    Chisqure_solve
    
    Return the difference between calculated percentile and P.
    
    Written January 1998 by C. Torrence
    """
    pguess = gammainc(v/2,v*xguess/2)
    pdiff = np.abs(pguess - p)
    if pguess >= 1-1e-4:
        pdiff = xguess
    return pdiff
Esempio n. 6
0
def AbsorptionConditionalProb(a, b):
    ''' probability that F_ti+1 is absorbed by the 0 barrier conditional on inital value S0  '''
    cprob = 1. - gammainc(b / 2, a / 2)  # formula (2.10), scipy gammainc is already normalized by gamma(b) 
    return cprob
 def theoretical_distribution(self):
     x = np.sort(self.sample)
     y = np.array([gammainc(self.freedom_degrees / 2, i / 2) for i in x])
     plt.plot(x, y, 'r-')