Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: negative variance after gb2fit

 From Michal Brzezinski <[email protected]> To [email protected] 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 <[email protected]>:
> 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
> [email protected]
>
> ----------------------------------------------------------------
> 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/
```