Learn R Programming

Smisc (version 0.3.9.1)

pcbinom: A continuous version of the binomial cdf

Description

Uses the incomplete beta function to calculate a continuous version of the binomial cumulative distribution function.

Usage

pcbinom(x, n, p, lower.tail = TRUE, log.p = FALSE)

Arguments

x

Real valued vector of the number of successes.

n

Real valued vector, all elements in [0, Inf), of the number of trials.

p

Real valued vector, all elements in [0,1], of the probability of success.

lower.tail

logical; if TRUE, the probabilities are P[X <= x], otherwise, P[X > x].

log.p

logical; if TRUE, probabilities p are returned as log(p).

Value

Returns a continuous version of the binomial distribution function.

Details

pcbinom is equivalent to pbinom for integer values of n and x.

Note that pcbinom does not recycle vectors in the usual fashion. Each of the arguments x, n, and p should have the same length, or, one or more of them can have the same length, so long as the other arguments have length 1. See examples below.

See Also

pbinom, pbeta

Examples

Run this code
# NOT RUN {
x <- c(  2,   3,   5, 5.2,   5)
n <- c(  4,   5,   7,   7, 7.2)
p <- c(0.2, 0.1, 0.8, 0.8, 0.7)

pcbinom(x, n, p)
pbinom(x, n, p)

# These will work
pcbinom(c(7.3, 7.8), 12, 0.7)
pcbinom(c(7.3, 7.8), c(12,13), 0.7)
pcbinom(12.1, c(14.2,14.3), 0.6)

# But these won't
try(pcbinom(c(7.3, 7.8), c(12, 14, 16), 0.7))
try(pcbinom(c(7.3, 7.8), c(12, 14, 16), c(0.7, 0.8)))


# }

Run the code above in your browser using DataLab