In R, is it possible for pbinom to take a noninteger x? I have a homework problem that is asking: "Find the probability that x is within 1 standard deviation of the mean for binomial(n = 20, p = 0.25)".
I found ${\mu} = 5$ and ${\sigma} = 1.94$. So I need to find $P(3.06 < x < 6.94)$. In R, I did pbinom(6.94, 20, .25) - pbinom(3.06, 20, .25) and got 0.561.
How did R compute pbinom when q isn't an integer? I'm confused as to how it's possible to do this when a binomial distribution is discrete.

There are two ways of doing this.

*

*Use a normal approximation to the sampling distribution of the sample mean.

*Round the endpoints to the "closest" integer to get a conservative interval.

You may ask the teacher for clarity if this isn't clearly an application of some methods you've already covered.
EDIT:
Though R provides output for these values, the existence of their result is somewhat of an artifact of using the gamma functional to estimate the combinatorial terms in the expression of the density function. There is but a little "window" of gamma probability around the non-integral values, and relatively steep "steps" in the CDF. Importantly these "windows" and "steep steps" don't correspond to any physical term, nor does it make any practical difference from rounding.


One can try:
set.seed(123)
sim <- rbinom(1e7, 20, 0.25)
mean(3.06 < sim & sim < 6.94)
mean(3 < sim & sim <= 6)

and find

mean(3.06 < sim & sim < 6.94)
1 0.5605642
mean(3 < sim & sim <= 6)
1 0.5605642

similarly:
> pbinom(6.94, 20, 0.25) - pbinom(3.06, 20, 0.25)
[1] 0.5606259
> pbinom(6, 20, 0.25) - pbinom(3, 20, 0.25)
[1] 0.5606259

