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)
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)
def get_variance(self): ''' Returns variance of gamma random variable ''' return scipygamma.var(self._alpha, self._shift, self._scale)
def var(self, dist): return gamma.var(*self._get_params(dist))
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) )