Javatpoint Logo
Javatpoint Logo

Binomial Distribution

The binomial distribution is also known as discrete probability distribution, which is used to find the probability of success of an event. The event has only two possible outcomes in a series of experiments. The tossing of the coin is the best example of the binomial distribution. When a coin is tossed, it gives either a head or a tail. The probability of finding exactly three heads in repeatedly tossing the coin ten times is approximate during the binomial distribution.

R allows us to create binomial distribution by providing the following function:

R Binomial Distribution

These function can have the following parameters:

S.No Parameter Description
1. x It is a vector of numbers.
2. p It is a vector of probabilities.
3. n It is a vector of observations.
4. size It is the number of trials.
5. prob It is the probability of the success of each trial.

Let's start understanding how these functions are used with the help of the examples

dbinom(): Direct Look-Up, Points

The dbinom() function of R calculates the probability density distribution at each point. In simple words, it calculates the density function of the particular binomial distribution.

Example

Output:

R Binomial Distribution

pbinom():Direct Look-Up, Intervals

The dbinom() function of R calculates the cumulative probability(a single value representing the probability) of an event. In simple words, it calculates the cumulative distribution function of the particular binomial distribution.

Example

Output:

R Binomial Distribution

qbinom(): Inverse Look-Up

The qbinom() function of R takes the probability value and generates a number whose cumulative value matches with the probability value. In simple words, it calculates the inverse cumulative distribution function of the binomial distribution.

Let's find the number of heads that have a probability of 0.45 when a coin is tossed 51 times.

Example

Output:

R Binomial Distribution

rbinom()

The rbinom() function of R is used to generate required number of random values for given probability from a given sample.

Let's see an example in which we find nine random values from a sample of 160 with a probability of 0.5.

Example

Output:

R Binomial Distribution
Next TopicR Classification




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA