def test__covariance__shape_and_scale_specified__calculated_based_on_shape_and_scale(
         self):
     for (shape, scale) in utils.get_shape_scale_pairs():
         gamma_model = sm.GammaStochasticModel(shape=shape, scale=scale)
         desired_variance = gamma.var(shape, scale=scale)
         assert_array_almost_equal(gamma_model.covariance,
                                   desired_variance,
                                   decimal=5)
Exemple #2
0
 def __init__(self, mode=0, elem=None, sample=None):
     if mode == 0:
         self.a = elem[0]
         self.mu = elem[1]
         self.sigma = elem[2]
     else:
         self.a, self.mu, self.sigma = gamma.fit(sample)
     self.math_average = gamma.mean(self.a, loc=self.mu, scale=self.sigma)
     self.dispersion = gamma.var(self.a, loc=self.mu, scale=self.sigma)
Exemple #3
0
 def get_variance(self):
     '''
     Returns variance of gamma random variable
     '''
     return scipygamma.var(self._alpha, self._shift, self._scale)
Exemple #4
0
 def var(self, dist):
     return gamma.var(*self._get_params(dist))
Exemple #5
0
 def var(self, n, p):
     var = gamma.var(self, n, p)
     return var
 def covariance(self):
     return np.atleast_2d(
         gamma.var(self._shape, scale=self._scale)
     )