pbinom function

This function returns the value of the cumulative density function (cdf) of the binomial distribution given a certain random variable q, number of trials (size), and probability of success on each trial (prob). 

Syntax: pbinom(x, size, prob)

Parameters:

  • x: a vector of numbers.
  • size: the number of trials.
  • prob: the probability of success of each trial.

pbinom function returns the area to the left of a given value q in the binomial distribution. If you’re interested in the area to the right of a given value q, you can simply add the argument lower.tail = FALSE

Syntax:

pbinom(q, size, prob, lower.tail = FALSE) 

Example 1:

Under this example, we are calculating the probability to get a head more than 3 times if the coin is flipped fairly 10 times using the pbinom() function. Since the coin is tossed fairly the prob parameter to the function is passed to be 0.5. 

R




pbinom(3, size=10, prob=.5, lower.tail=FALSE)


Output:

[1] 0.828125

Example 2:

In this example, we are calculating the probability if a man scores a strike on 30% of his attempts when he bowls, If he bowls 50 times, what is the probability that he scores 30 or fewer strikes using the pbinom() function in R.

R




pbinom(30, size=50, prob=.7)


Output:

[1] 0.0848026

A Guide to dbinom, pbinom, qbinom, and rbinom in R

In this article, we will be looking at a guide to the dbinom, pbinom, qbinom, and rbinom methods of the binomial distribution in the R programming language.

Similar Reads

dbinom function

This function returns the value of the probability density function (pdf) of the binomial distribution given a certain random variable x, number of trials (size), and probability of success on each trial (prob)....

pbinom function

...

qbinom function

...

rbinom function

This function returns the value of the cumulative density function (cdf) of the binomial distribution given a certain random variable q, number of trials (size), and probability of success on each trial (prob)....

Contact Us