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: twoway function and invbinomial function


From   vwiggins@stata.com (Vince Wiggins, StataCorp)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: twoway function and invbinomial function
Date   Thu, 21 Jun 2012 12:37:51 -0500

Maarten Buis <maartenlbuis@gmail.com> has uncovered a bug in 
-graph twoway function- that can only be triggered by the
-invbinomial()- function.

Maarten writes, 

> I would have expected the two graphs from the example below to be
> the same, but they are not. Can someone spot my error?

> *----------------- begin example ------------------
> clear
> set obs 300
> range n 5e2 5e4
> format n %9.0gc
> gen ub = invbinomial(n,.05*n,.025)
> twoway line ub n, name(gr1, replace)
>
> twoway function ub = invbinomial(x,.05*x,.025), ///
>        range(5e2 5e4) name(gr2, replace)
> *------------------ end example -------------------

Expressions provided to -graph twoway function- are currently evaluated
under Stata version 8.  That is a bug, and in the next update
expressions will be evaluated under the version in force at the time
-graph- is invoked.

That said, this is an extremely difficult bug to tickle.  Aside from
improved accuracy in some functions, Stata expressions that do not
involve -invbinomial()- return the same things under Stata 8 and Stata
12.

During a very short period after it's creation, the -invbinomial()-
function returned what is now returned by -invbinomialtail()-.  That
was intentional at the time, because that is the most accurate inverse
that can be computed for the binomial.  Very soon after -invbinomial()-
was created, we standardized Stata's convention for naming distribution
functions.  We created -invbinomialtail()- to do the work of
-invbinomial()-, and, to be consistent with all other distribution
functions, -invbinomial()- was made to return the inverse of the
cumulative binomial.

 
-- Vince 
   vwiggins@stata.com


*
*   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