{smcl}
{* 19dec2006/17aug2011}{...}
{hline}
help for {hi:invgammafit}
{hline}

{title:Fitting a two-parameter inverse gamma distribution by maximum likelihood}

{p 8 17 2}
{cmd:invgammafit} 
{it:varname} 
[{it:weight}] 
[{cmd:if} {it:exp}]
[{cmd:in} {it:range}] 
[{cmd:,} 
{cmdab:alpha:var(}{it:varlist1}{cmd:)}
{cmdab:beta:var(}{it:varlist2}{cmd:)} 
{cmdab:r:obust}
{cmdab:cl:uster(}{it:clustervar}{cmd:)}  
{cmdab:l:evel(}{it:#}{cmd:)}
{it:maximize_options} ]

{p 4 4 2}{cmd:by} {it:...} {cmd::} may be used with 
{cmd:invgammafit}; see help {help by}. 

{p 4 4 2}{cmd:fweight}s and {cmd:aweight}s are allowed; 
see help {help weights}.


{title:Description}

{p 4 4 2} {cmd:invgammafit} fits by maximum likelihood a two-parameter
inverse gamma distribution to a distribution of a variable
{it:varname}. The distribution has probability density function for
variable x > 0, shape parameter a > 0 and scale parameter
b > 0 of {bind:(b^a / Gamma(a)) x^(-a - 1) exp(-b / x)}. 


{title:Options}

{p 4 8 2}{cmd:alphavar(}{it:varlist1}{cmd:)} and
{cmd:betavar(}{it:varlist2}{cmd:)} 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. 

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

{p 4 8 2}{cmd:cluster(}{it:clustervar}{cmd:)} specifies that the observations
are independent across groups (clusters) but not necessarily within groups.
{it:clustervar} specifies to which group each observation belongs; e.g.,
{cmd:cluster(personid)} in data with repeated observations on individuals.  See
{hi:[U] 20.14 Obtaining robust variance estimates}.  Specifying {cmd:cluster()}
implies {cmd:robust}.

{p 4 8 2}{cmd:level(}{it:#}{cmd:)} specifies the confidence level, in percent,
for the confidence intervals of the coefficients; see help {help level}.

{p 4 8 2}{cmd:nolog} suppresses the iteration log.

{p 4 8 2}{it:maximize_options} control the maximization process; see 
help {help maximize}. If you are seeing many "(not concave)" messages in the 
log, using the {cmd:difficult} option may help convergence.


{title:Remarks} 

{p 4 4 2}This distribution is also described as the inverted gamma, 
the reciprocal gamma, a Pearson Type V distribution and the Vinci
distribution. 


{title:Saved results}

{p 4 4 2}In addition to the usual results saved after {cmd:ml}, {cmd:invgammafit}
also saves the following, if no covariates have been specified: 

{p 4 4 2}{cmd:e(alpha)} and {cmd:e(beta)} are the estimated inverse 
gamma parameters.

{p 4 4 2}The following results are saved regardless of whether covariates have
been specified:

{p 4 4 2}{cmd:e(b_alpha)} and {cmd:e(b_beta)} are row vectors containing the
parameter estimates from each equation. 

{p 4 4 2}{cmd:e(length_b_alpha)} and {cmd: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.

	
{title:Examples}

{p 4 8 2}{cmd:. invgammafit mpg}


{title:Authors}

{p 4 4 2}Nicholas J. Cox, Durham University{break}n.j.cox@durham.ac.uk

{p 4 4 2}Stephen P. Jenkins, London School of Economics{break}s.jenkins@lse.ac.uk


{title:Acknowledgments}

{p 4 4 2}Maarten Buis found a long-lurking bug. 


{title:References}

{p 4 8 2}
Evans, M., Hastings, N. and Peacock, B. 2000. {it:Statistical distributions.}
New York: John Wiley.

{p 4 8 2}
Jeffreys, H. 1961. {it:Theory of probability.} 
Oxford: Oxford University Press (see p.77). 

{p 4 8 2} 
Kleiber, C. and Kotz, S. 2003. 
{it:Statistical size distributions in economics and actuarial sciences.} 
Hoboken, NJ: John Wiley. 


{title:Also see}

{p 4 13 2}
Online: help for 
{help pinvgamma} (if installed), 
{help qinvgamma} (if installed) 

