MATLAB Examples

Compute Geometric Distribution Probabilities

Suppose the probability of a five-year-old car battery not starting in cold weather is 0.03. What is the probability of the car starting for 25 consecutive days during a long cold snap?

Model the scenario using a geometric distribution. In this case, the "failure" event is the car starting, and the "success" event is the car not starting. We want to determine the probability of observing 25 failures (the car starting) without observing a single success (the car not starting). The probability of success for each trial (the car not starting in any single attempt) is P = 0.03.

To solve, first compute the cumulative distribution function (cdf) for x = 25 trials. This returns the probability of observing success (the car not starting) in up to 25 trials. Then subtract this result from 1 to determine the probability of $\textit{not}$ observing success in up to 25 trials - in other words, the probability that the car starts at every one of the 25 attempts.

pstart = 1 - geocdf(25,0.03)
pstart =

    0.4530

The returned result pstart = 0.4530 is the probability that the car will start every day for 25 days in a row during a cold snap.

This plot of the cdf for this scenario shows that, as the number of trials (x) increases, the probability of success (y) also increases. In the context of this example, it means that the more times you attempt to start the car, the greater the probability that it does not start on at least one of those occasions.

figure;
x = 0:25;
y = geocdf(x,0.03);
stairs(x,y)