Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -invgaussfit- available on SSC


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: -invgaussfit- available on SSC
Date   Sat, 16 Dec 2006 13:35:53 -0000

Thanks to Kit Baum, a new package -invgaussfit- 
is available on SSC. Use -ssc- to describe or install
if interested. 

The parent program -invgaussfit- fits a two-parameter 
inverse Gaussian distribution with a location parameter 
and a scale parameter, optionally as dependent on 
covariates. -invgausscf- does the same using closed
form solutions, except that no covariates are allowed. 
Stata 8.1 is required for both. -invgaussfit- is based
on a program written by Stephen Jenkins for another
distribution, so he is joint author. 

In the same package, -qinvgauss- and -pinvgauss- produce 
quantile-quantile and probability-probability plots for 
observed data versus results from a fitted inverse Gaussian. 
Stata 9 is required for both.  Various Mata functions
for the inverse Gaussian for density, cdf and  quantile (inverse
cdf) calculations are included in the code for -qinvgauss-.

To those who are thinking: hasn't this been done already? 

The inverse Gaussian does appear in various guises in other 
Stata model fit commands, but none is identical. -glm- with 
identity link and inverse Gaussian family is similar except 
that the parameterisation is different; the scale parameter 
is there treated as ancillary, and thus the definition of 
likelihood is quite different; and -glm- does not allow the 
scale parameter to depend on covariates.  Various programs by Joseph
Hilbe (Hilbe 2000 and later work on SSC accessible using 
-findit- and -ssc-) wire in log link functions. Finally, 
the use of inverse Gaussian as one way of modelling frailty in 
-streg- differs yet again. Note, however, that the program 
-geninvgauss- by Roberto Gutierrez in his -gendist- package 
(accessible using -findit-) that produces random deviates
from an inverse Gaussian uses the same parameterisation, 
and indeed the same names mu and lambda, as this package.
(Thanks to Bobby for reminding me of his work here.) 

Hilbe, J. 2000.  Two-parameter log-gamma and log-inverse 
Gaussian models. Stata Technical Bulletin 53: 31-32 (STB 
Reprints 9: 273-275).

This package is the latest public addition to a intermittent
series for various continuous distributions. My own interests 
here mostly centre on the relative merits of candidates for
modelling right-skewed unimodal environmental responses, but
the "environmental" is naturally not a restriction. As 
a matter of convenience, as programs are developed I usually
try them out on the -mpg- variable of the auto data and I 
am happy to report the discovery that -mpg- fits the inverse
Gaussian very nicely (and vice versa). 

I've tried to match many of the conventions followed by 
official Stata in associated commands. A look at the help
for -diagplots- underlines that as far as q-q and p-p plots 
for observed versus theoretical distributions are concerned, 
StataCorp wrote -qnorm-, -pnorm-, -qchi- and -pchi- some
time ago and then lost interest. Naturally, there are at 
least two good explanations: first, there are so many 
distributions that somebody might want that it is really difficult
to choose between them; and second, that each quantile function
or distribution function is typically a line or two of Stata after 
which we have, minimally, a standard scatter plot. However, 
the StataCorp convention of calling the quantile function the 
inverse distribution function (illustrated by "Inverse Normal" 
in -qnorm- and many function names) leads to "Inverse inverse Gaussian" 
and I would like to assure anyone who notices that titling that 
it is not a programming error. 

Next down the road is the inverse gamma, 
a.k.a. inverted gamma, reciprocal gamma or Pearson V.

Nick 
[email protected] 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index