A generalized gamma continuous random variable.
Continuous random variables are defined from a standard form and may require some shape parameters to complete its specification. Any optional keyword parameters can be passed to the methods of the RV object as given below:
Parameters: | x : array-like
q : array-like
a,c : array-like
loc : array-like, optional
scale : array-like, optional
size : int or tuple of ints, optional
moments : string, optional
|
---|---|
Methods: | gengamma.rvs(a,c,loc=0,scale=1,size=1) :
gengamma.pdf(x,a,c,loc=0,scale=1) :
gengamma.cdf(x,a,c,loc=0,scale=1) :
gengamma.sf(x,a,c,loc=0,scale=1) :
gengamma.ppf(q,a,c,loc=0,scale=1) :
gengamma.isf(q,a,c,loc=0,scale=1) :
gengamma.stats(a,c,loc=0,scale=1,moments=’mv’) :
gengamma.entropy(a,c,loc=0,scale=1) :
gengamma.fit(data,a,c,loc=0,scale=1) :
Alternatively, the object may be called (as a function) to fix the shape, : location, and scale parameters returning a “frozen” continuous RV object: : rv = gengamma(a,c,loc=0,scale=1) :
|
Examples
>>> import matplotlib.pyplot as plt
>>> numargs = gengamma.numargs
>>> [ a,c ] = [0.9,]*numargs
>>> rv = gengamma(a,c)
Display frozen pdf
>>> x = np.linspace(0,np.minimum(rv.dist.b,3))
>>> h=plt.plot(x,rv.pdf(x))
Check accuracy of cdf and ppf
>>> prb = gengamma.cdf(x,a,c)
>>> h=plt.semilogy(np.abs(x-gengamma.ppf(prb,c))+1e-20)
Random number generation
>>> R = gengamma.rvs(a,c,size=100)
Generalized gamma distribution
gengamma.pdf(x,a,c) = abs(c)*x**(c*a-1)*exp(-x**c)/gamma(a) for x > 0, a > 0, and c != 0.