Re: [R] two-tailed exact binomail test

2005-08-27 Thread Matthias Kohl
Peter Dalgaard wrote:

>katrina smith <[EMAIL PROTECTED]> writes:
>
>  
>
>>I am trying to find a definition for the two-tailed exact binomial
>>test but have been unsuccessful. Can you help?
>>
>>
>
>Just read binom.test. The relevant bit is this:
>(m is the mean == n*p)
>
>else if (x < m) {
>i <- seq(from = ceiling(m), to = n)
>y <- sum(dbinom(i, n, p) <= d * relErr)
>pbinom(x, n, p) + pbinom(n - y, n, p, lower = FALSE)
>}
>
>i.e. we take the lower tail, including the value observed + the part
>of the upper tail where the binomial density is less than or equal to
>that of x (with a little fuzz added in). Symmetrically for observations
>in the upper tail of course.
>
>If you were looking for an "official" definition of the two sided
>exact test, I don't think one exists. R's version is equivalent to the
>likelihood ratio test, but there are alternatives (tail-balancing,
>doubling the one-sided p, and maybe more).
>
>  
>
there is a reference:
Section 2.4.2 ("Zweiseitige Tests in einparametrigen 
Exponentialfamilien" - two sided tests in one-parameter exponential 
families) in

H. Witting (1985): Mathematische Statistik I. Teubner. Stuttgart

confer Satz 2.70, Korollar 2.73 (in case of symmetry)
and Beispiel 2.74 (application of Korollar 2.73 to binomial model for p= 
0.5).

Matthias

__
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


Re: [R] two-tailed exact binomail test

2005-08-27 Thread Peter Dalgaard
katrina smith <[EMAIL PROTECTED]> writes:

> I am trying to find a definition for the two-tailed exact binomial
> test but have been unsuccessful. Can you help?

Just read binom.test. The relevant bit is this:
(m is the mean == n*p)

else if (x < m) {
i <- seq(from = ceiling(m), to = n)
y <- sum(dbinom(i, n, p) <= d * relErr)
pbinom(x, n, p) + pbinom(n - y, n, p, lower = FALSE)
}

i.e. we take the lower tail, including the value observed + the part
of the upper tail where the binomial density is less than or equal to
that of x (with a little fuzz added in). Symmetrically for observations
in the upper tail of course.

If you were looking for an "official" definition of the two sided
exact test, I don't think one exists. R's version is equivalent to the
likelihood ratio test, but there are alternatives (tail-balancing,
doubling the one-sided p, and maybe more).

-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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


Re: [R] two-tailed exact binomail test

2005-08-27 Thread P. Olsson
You might find the answer in Chapter 2 of Nonparametric statistical
methods written by Myles Hollander and Douglas A. Wolfe (2nd ed.,
ISBN: 0-471-19045-4)

2005/8/27, katrina smith <[EMAIL PROTECTED]>:
> I am trying to find a definition for the two-tailed exact binomial test but 
> have been unsuccessful. Can you help?
> 
> 
> 
> 
> -
> 
> [[alternative HTML version deleted]]
> 
> __
> 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
>

__
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


[R] two-tailed exact binomail test

2005-08-27 Thread katrina smith
I am trying to find a definition for the two-tailed exact binomial test but 
have been unsuccessful. Can you help?
 



-

[[alternative HTML version deleted]]

__
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