# [R] binom.test inside ctest

BXC (Bendix Carstensen) BXC at novo.dk
Tue Sep 12 11:02:04 CEST 2000

```> -----Original Message-----
> From: gb [mailto:gb at stat.umu.se]
> Sent: 12. september 2000 08:40
> To: Mai Zhou
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] binom.test inside ctest
>
>
> Mai,
>
> it seems as if binom.test only adds half the probability of
> of the border point 65 to the p-value. If you try
>
> > (1-pbinom(64, 100, p = 0.5)) + pbinom(34, 100, p=0.5)
> [1] 0.002653786
>
> you get the same result as binom.test.

Göran,

Rather, it adds the border point only once:
I think the general idea is:

> db <- dbinom(0:100,100,p=0.5)
> obs.p <- dbinom(65,100,p=0.5)
> sum(db[db<obs.p])+obs.p
[1] 0.002653786

Bendix
>
>
> Göran
>
> On Tue, 12 Sep 2000, Mai Zhou wrote:
>
> > I got
> >
> > binom.test(65, 100, p=0.5)
> >
> >
> > p-value = 0.002654
> >
> > I thought in this case (when p=0.5 so a symmetric distribution)
> > we should get
> >
> > p-value = 2*( 1-pbinom(64, 100, p=0.5) ) = 0.003517642
> >
> > Can somebody explain why the difference?
> >
> > Thanks.
> >
> > Mai Zhou
> >
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read
> http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To:
> r-help-request at stat.math.ethz.ch
> >
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._._._._._
> >
>
> --
>  Göran Broström                      tel: +46 90 786 5223
>  Department of Statistics            fax: +46 90 786 6614
>  Umeå University
>  SE-90187 Umeå, Sweden             e-mail: gb at stat.umu.se
>

----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Centre
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 28 25 87 38
fax: +45 44 43 73 13
bxc at novo.dk
www.biostat.ku.dk/~bxc
----------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```