Probability of a machine lasting X days

A new machine arrives in a factory. This type of machine is very unreliable: every day, it has a 10% chance of breaking permanently. How long would you expect it to last?

Notice that this is described by the cumulative distribution of the geometric distribution, and therefore the pgeom() function. pgeom(X, .1) would describe the probability that there are X working days before the day it breaks (that is, that it breaks on day X + 1).

This exercise is part of the course

Foundations of Probability in R

View Course

Exercise instructions

  • Use pgeom() to find the probability that the machine breaks on the 5th day or earlier.
  • Use pgeom() to find the probability that the machine is still working by the end of the 20th day.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Find the probability the machine breaks on 5th day or earlier


# Find the probability the machine is still working on 20th day