```-------------------------------------------------------------------------------
help for gammafit
-------------------------------------------------------------------------------

Fitting a two-parameter gamma distribution by maximum likelihood

gammafit varname [weight] [if exp] [in range] [, alphavar(varlist1)
betavar(varlist2) alternative robust cluster(clustervar)
level(#) maximize_options ]

by ... : may be used with gammafit; see help by.

fweights and aweights are allowed; see help weights.

Description

gammafit fits by maximum likelihood a two-parameter gamma distribution to
a distribution of a variable varname. The distribution has probability
density function for variable x >= 0, shape parameter a > 0 and scale
parameter b > 0 of [1 / (b^a gamma(a))] x^(a - 1) exp(-x / b).  See also
the alternative option.

Options

alphavar(varlist1) and betavar(varlist2) allow the user to specify each
parameter as a function of the covariates specified in the respective
variable list. A constant term is always included in each equation.

alternative specifies use of an alternative parameterisation [(b^a /
gamma(a))] x^(a - 1) exp(-bx).

robust specifies that the Huber/White/sandwich estimator of variance is
to be used in place of the traditional calculation; see [U] 23.14
Obtaining robust variance estimates.  robust combined with cluster()
allows observations which are not independent within cluster
(although they must be independent between clusters).

cluster(clustervar) specifies that the observations are independent
across groups (clusters) but not necessarily within groups.
clustervar specifies to which group each observation belongs; e.g.,
cluster(personid) in data with repeated observations on individuals.
See [U] 23.14 Obtaining robust variance estimates.  Specifying
cluster() implies robust.

level(#) specifies the confidence level, in percent, for the confidence
intervals of the coefficients; see help level.

nolog suppresses the iteration log.

maximize_options control the maximization process; see help maximize. If
you are seeing many "(not concave)" messages in the log, using the
difficult option may help convergence.

Saved results

In addition to the usual results saved after ml, gammafit also saves the
following, if no covariates have been specified:

e(alpha) and e(beta) are the estimated gamma parameters.

The following results are saved regardless of whether covariates have
been specified:

e(b_alpha) and e(b_beta) are row vectors containing the parameter
estimates from each equation.

e(length_b_alpha) and e(length_b_beta) contain the lengths of these
vectors. If no covariates are specified in an equation, the corresponding
vector has length equal to 1 (the constant term); otherwise, the length
is one plus the number of covariates.

Examples

. gammafit mpg

Authors

Nicholas J. Cox, Durham University
n.j.cox@durham.ac.uk

Stephen P. Jenkins, London School of Economics
s.jenkins@lse.ac.uk

References

Forbes, C., Evans, M., Hastings, N. and Peacock, B. 2011. Statistical
distributions.  Hoboken, NJ: John Wiley.

Johnson, N.L., Kotz, S. and Balakrishnan, N. 1994.  Continuous univariate
distributions: Volume 1. New York: John Wiley.

Kleiber, C. and Kotz, S. 2003.  Statistical size distributions in
economics and actuarial sciences.  Hoboken, NJ: John Wiley.

Also see

Online: help for pgamma (if installed), qgamma (if installed)

```