[R] binom calculation with range

Ethan Johnsons ethan.johnsons at gmail.com
Thu Oct 12 17:49:06 CEST 2006


What is the way to calculate the probability that between 1 and 5?
i.e.

We can do:

> pbinom(q=1,size=1000,prob=0.0005,lower.tail=FALSE)
[1] 0.09016608
> pbinom(q=5,size=1000,prob=0.0005,lower.tail=FALSE)
[1] 1.398798e-05
> pbinom(q=1:5,size=1000,prob=0.0005,lower.tail=FALSE)
[1] 9.016608e-02 1.435924e-02 1.743731e-03 1.707366e-04 1.398798e-05

But it is really about pr(1 <= X <= 5).

I can think of:

pbinom(q=5,size=1000,prob=0.0005,lower.tail=FALSE) -
pbinom(q=1,size=1000,prob=0.0005,lower.tail=FALSE)

but, I am unsure if we don't have any other options for calculating it in R.

thx much.



More information about the R-help mailing list