Nick Cox wrote:
A small tweak to Joseph's useful program.
It feeds on a given sample size and
population proportion, but irrespective
of the latter 0.5 is wired in to a crucial
line. So I suggest
return scalar `method'_covered =
(`pi' >= r(lb)) & (`pi' <= r(ub))
-inrange(`pi', r(lb), r(ub))- is a
another way of doing it.
----------------------------------------------------------------------------
Whoops--thanks Nick!
It started out fixed at 0.5 throughout; it originally was intended only as
an illustration where listers could see in the Stata code (invoking the
definition of the term, confidence interval) the difference between
probability of coverage, which was Bobby Gutierrez's point, and *exact* in
Constantine Daskalakis's sense. For the purpose of the illustration, the
true proportion was arbitrarily fixed at 0.5 in the original code. When
Paul Seed posted his question, the original purpose was abandoned, and I
tried--alas, too hastily--to generalize the program for another purpose: a
further illustration of the versatility of simulation to answer questions in
the absence of alternative means.
Thanks also (and to Bobby) for making -bincoverage- available as one such
alternative means. It is certainly preferable to simulation for practical
work.
Joseph Coveney
*
* 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/