pcbinom: A continuous version of the binomial cdf

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/pcbinom.R

Description

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

Usage

1
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).

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.

Value

Returns a continuous version of the binomial distribution function.

Note

This function was based on binom.c in the R source code.

Author(s)

Landon Sego

See Also

pbinom, pbeta

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)))

Smisc documentation built on May 2, 2019, 2:46 a.m.