Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: negative variance after gb2fit

From   <>
To   <>
Subject   st: negative variance after gb2fit
Date   Wed, 4 Jul 2012 10:57:51 +0100

Many thanks to Michal Brzezinski for spotting this little bug. I'll send
a corrected version of -gb2fit- to Kit Baum to replace the existing one
on SSC


Date: Tue, 3 Jul 2012 23:41:34 +0200
From: Michal Brzezinski <>
Subject: Re: st: negative variance after gb2fit

I think that there is a typo in gb2fit in calculating variance for the
fitted model.
Lines 236-239 of gb2fit are:
			eret scalar var = `b'*`b'*exp(lngamma(1+2/`a'))
exp(lngamma(`p'))*exp(lngamma(`q')) ) 	///
				 	- (`e(mean)'*`e(mean)')

"1" in the first line should be replaced with "p", so that the correct
expression for variance is:

			eret scalar var =
`b'*`b'*exp(lngamma(`p'+2/`a')) 		///
exp(lngamma(`p'))*exp(lngamma(`q')) ) 	///
				 	- (`e(mean)'*`e(mean)')

I hope that this helps with your problem.

Michal Brzezinski

Professor Stephen P. Jenkins <>
Department of Social Policy 
London School of Economics and Political Science
Houghton Street, London WC2A 2AE, U.K.
Tel: +44 (0)20 7955 6527
Changing Fortunes: Income Mobility and Poverty Dynamics in Britain, OUP
Survival Analysis using Stata:  
Downloadable papers and software: 

Please access the attached hyperlink for an important electronic communications disclaimer:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index