예제 #1
0
def pl(l, p, sigma, lm, ls):
    return np.exp(
        np.sum(
            np.log([
                pl_no_gamma(l, x, sigma) * gamma.pdf(l, lm, scale=ls) /
                get_max(x, sigma) for x in p
            ])))
예제 #2
0
 def is_gamma(self, account_name, stats_name):
     """
     #TODO: To really try to say anything about is_gamma or not,
         we need to know the histogram/bin-wise frequency of the original data
     #Setup bin ranges and counters and track that too for extra price
     """
     from scipy.stats.distributions import gamma
     m1, m2, m3, m4 = getMoments(account_name, stats_name)
     alpha_mom = (m1**2) / m2
     beta_mom = m2 / m1
     plt.plot(np.linspace(0, 10),
              gamma.pdf(np.linspace(0, 10), alpha_mom[0], beta_mom[0]))
     pass
예제 #3
0
def gamma_pdf(mean, sd):
    """Define a gamma distribution PDF from its mean and standard deviation"""
    coef_of_variation = sd / mean
    alpha = 1 / coef_of_variation**2
    beta = alpha / mean
    return lambda x: gamma.pdf(x, a=alpha, scale=1 / beta)
예제 #4
0
def pl(l,p,sigma,lm,ls):
    return np.exp(np.sum(np.log([pl_no_gamma(l,x,sigma)*gamma.pdf(l,lm,scale=ls)/get_max(x,sigma) for x in p])))
예제 #5
0
 def pdf(self, data):
     return gamma.pdf(-(data-self.mu), self.shape, scale=self.scale)
예제 #6
0
def calc_resp(data, shape1, scale1, shape2, scale2):
    resp1 = gamma.pdf(data, shape1, scale=scale1)
    resp2 = gamma.pdf(data, shape2, scale=scale2)
    return resp1, resp2
예제 #7
0
def opt_func(param,x, resp):
    return -np.sum(np.log(gamma.pdf(x, param[0], scale=param[1]))*resp,axis=0)