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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: negative variance after gb2fit


From   Michal Brzezinski <michalbrzez@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: negative variance after gb2fit
Date   Tue, 3 Jul 2012 23:41:34 +0200

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(`q'-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(`q'-2/`a'))		   	///
					   /( exp(lngamma(`p'))*exp(lngamma(`q')) ) 	///
				 	- (`e(mean)'*`e(mean)')

I hope that this helps with your problem.

Michal Brzezinski
University of Warsaw
Faculty of Economic Sciences


2012/7/2 Lucia Latino <Latino@economia.uniroma2.it>:
> Dear statalist,
>
> I tried to fit data on household food consumption to a generalized beta of
> second kind using 'gb2fit' command.
>
> gb2fit dec, stats cdf(gb2cdf) pdf(gb2pdf) svy
>
> I obtained a negative variance. How is it possible? What does it tell me?
>
> If it is useful, notice that the sample was drawn using a two-stage
> stratified sampling procedure which I took into account by svyset my data.
> I hope you can help me.
>
> Thank you very much
>
> Lucia
>
>
> --
> *********************************
> Lucia Rita Latino
> PhD International Economics
> Department of Economics
> University of Rome "Tor Vergata"
> Via Columbia, 2 - 00133 Roma
> Latino@Economia.uniroma2.it
>
> ----------------------------------------------------------------
> Invito da parte dell'Ateneo:
> Il tuo futuro e quello della Ricerca Scientifica hanno bisogno del
> tuo aiuto. Dona il  5 x mille all'Universita' di Roma Tor Vergata
> codice fiscale: 80213750583 http://5x1000.uniroma2.it
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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