Re: [R] prop.test() references

2007-02-05 Thread Jean lobry
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([EMAIL PROTECTED])
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/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] prop.test() references

2007-02-01 Thread Marc Schwartz
On Thu, 2007-02-01 at 07:22 +0100, Jean lobry wrote:
 Dear R-help,
 
 I'm using prop.test() to compute a confidence interval for a proportion
 under R version 2.4.1, as in:
 
 prop.test(x = 340, n = 400)$conf
 [1] 0.8103309 0.8827749
 
 I have two questions:
 
 1) from the source code my understanding is that the confidence
 interval is computed according to Wilson, E.B. (1927) Probable
 inference, the law of succession, and statistical inference.
 J. Am. Stat. Assoc., 22:209-212.
 Is it correct?

Yes.

 2) The doc says Continuity correction is used only if it does not exceed
 the difference between sample and null proportions in absolute value.
 Does someone has a reference in which this point is discussed?

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.


HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] prop.test() references

2007-01-31 Thread Jean lobry
Dear R-help,

I'm using prop.test() to compute a confidence interval for a proportion
under R version 2.4.1, as in:

prop.test(x = 340, n = 400)$conf
[1] 0.8103309 0.8827749

I have two questions:

1) from the source code my understanding is that the confidence
interval is computed according to Wilson, E.B. (1927) Probable
inference, the law of succession, and statistical inference.
J. Am. Stat. Assoc., 22:209-212.
Is it correct?

2) The doc says Continuity correction is used only if it does not exceed
the difference between sample and null proportions in absolute value.
Does someone has a reference in which this point is discussed?

Best,
-- 
Jean R. Lobry([EMAIL PROTECTED])
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/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.