[R] prop.test() references

Jean lobry lobry at biomserv.univ-lyon1.fr
Mon Feb 5 23:45:41 CET 2007


Dear Marc,

>  I believe that this is a modification by Newcombe. See:
>
>  Newcombe RG: Two-Sided Confidence Intervals for the Single Proportion:
>  Comparison of Seven Methods. Statistics in Medicine 1998;17:857-872.
>
>  Newcombe RG: Interval Estimation for the Difference Between Independent
>  Proportions: Comparison of Eleven Methods. Statistics in Medicine
>  1998;17:873-890.

thank you very much for the references. The paragraph with number 4
page 859 in Newcombe is as follows in LaTeX:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\begin{document}
Score method incorporating continuity corection\cite{six,nineteen}. 
The interval
consists of all $\theta$ such that $\left| p - \theta \right| - \frac{1}{2n}
\le z \sqrt{\frac{\theta(1 - \theta)}{n}}$. Expressions for the lower and
upper limits $L$ and $U$ in closed forms are available:

$$
L = \frac{2np + z^2 -1 -z \sqrt{z^2 -2 -\frac1n + 4p(nq +1)}}{2 (n + z^2)}
$$

$$
U = \frac{2np + z^2 +1 +z \sqrt{z^2 -2 -\frac1n + 4p(nq +1)}}{2 (n + z^2)}
$$

However, if $p = 0$, $L$ must be taken as $0$; if $p = 1$, $U$ is then $1$.

\begin{thebibliography}{99}
\bibitem{six} Blyth, C.R., Still, H.A. (1983) Binomial confidence intervals.
\textit{Journal of the American Statistical Association},\textbf{78}:108-116.
\bibitem{nineteen} Fleiss, J.L. (1981) \textit{Statistical Methods for Rates
and Proportions}, 2nd edn, Wiley, New York, USA.
\end{thebibliography}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

After some rearangements, the formulas for the lower (L) and upper (U)
bounds are consistent with the code used in prop.test(). Note that
Newcombe credits them to earlier works.

If I understand well the paper by Newcombe, the continuity correction
in the confidence interval according to Wilson (1927) is always used.

Could it be that it is the same when I'm using prop.test() just to
get the confidence interval as in prop.test(x = 340, n = 400) ?

the code :

YATES <- min(YATES, abs(x - n * p))

seems to have no effect because p is set to 0.5 by

if (is.null(p) && (k == 1))
         p <- 0.5

so that abs(x - n * p)) is at least 0.5

When correct == TRUE, YATES is initially set to 0.5, so
that min(0.5, >= 0.5) is always 0.5.

On an other hand, the doc says that "Continuity
correction is used only if it does not exceed the difference
between sample and null proportions in absolute value", so
that shouldn't it be something like abs(x/n - p) to have
two proportions ?

Sorry if it is obvious, but I'm completely lost here.

Best,
-- 
Jean R. Lobry            (lobry at biomserv.univ-lyon1.fr)
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56     fax    : +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/



More information about the R-help mailing list