dgeom function
The dgeom function finds the probability of experiencing a certain amount of failures before experiencing the first success in a series of Bernoulli trials. This returns the value of the geometric probability density function. In other words, it returns the probability of x failures prior o the first success (note the difference) when the probability of success is prob.
Syntax: dgeom(x, prob)
Parameter:
- x: number of failures before the first success
- prob: the probability of success on a given trial
Example 1:
In this example, we are calculating the probability of a man asking for help, and the probability of getting the help is 0.5(p=0.5) so with the use of the dgeom() function we are calculating the probability that the sixth person giving help will talk to the first person given help.
R
dgeom (x=5, prob=.5) |
Output:
[1] 0.015625
The probability that the person experiences 5 “failures” before the first success is 0.015625.
A Guide to dgeom, pgeom, qgeom, and rgeom in R
In this article, we will be looking at a guide to the dgeom, pgeom, qgeom, and rgeom methods of the geometric distribution in the R programming language.