# What is Rbinom doing in R.

For many common distributions there are functions in R to use probability (density) function, distribution function, quantile function and a random generator.

### Binomial distribution

Using the example of a binomial distribution with \ (n = 3 \) and \ (\ pi = \ frac {1} {6} \) you can determine the probability function \ (f (x) \) for a certain value x with. So if we want to know the value for \ (f (1) \) we use:

We get the distribution function \ (F (x) \) with. For the determination of \ (F (2) \) we use:

and thus obtain the probability \ (P (X \ le 2) = 0.995 \) for this specific distribution.

The quantile function is the inverse function of the distribution function. We can answer the question \ (P (X \ le 2) =? \) With the distribution function above. However, if the given information is exactly the opposite, i.e. we want to answer the question \ (P (X \ le?) = 0.995 \), we use:

and learn that with a given probability of \ (p = 0.995 \) values ​​of 2 or less can occur.

### Normal distribution

In the same way, we can use the same functions with,, and for any normal distribution. With the distribution function \ (F (x) \) we can, for example, find out for \ (x = -1 \) the probability with a normal distribution with \ (\ mu = 0 \) and \ (\ sigma ^ 2 = 1 \ ) a value of \ (x = -1 \) or less occurs.

Conversely, we can use the quantile function to answer the question \ (P (X \ le?) = 0.159 \):