Fast-Track Normal CDF Calculations Without the Jargon

Fast-Track Normal CDF Calculations Without the Jargon
Image by Author | Piktochart

The cumulative distribution function (CDF) describes the probability that a continuous random variable X takes on a value less than or equal to a specific value x. It is denoted by:

$F(x) = \Pr(X < x)$.

Some examples of real-world situations requiring the calculation of CDFs are:

  • The probability that a person is 180cm tall or less
  • The probability that a household income is below $50,000
  • The likelihood of completing a marathon in 4 hours or less
  • The probability of temperatures dropping below freezing

A question may arise at this point: how to easily calculate CDF like these without getting lost in overly technical terms and concepts? This article aims at describing this step-by-step process in a simplified manner, for datasets that follow a normal distribution, one of the most commonly assumed types of continuous probability distributions.

Step-by-Step Process

Let’s recall first that a normal or Gaussian probability distribution is visually represented as a bell-shaped curve like this:

CDF in a normal distribution

In a normal distribution, the most common values for a random variable X tend to cluster around the center, which is called the mean or average. In other words, values around the mean have the highest probability of being reported. As you move further away from this center, values on both sides become increasingly rare or less frequent. Adult height is a common example of a variable that closely follows this kind of distribution. Adult males measuring 170-180cm are more probable than those measuring 150cm or 200cm.

See the blue shaded area under part of the curve above? The area or size of that shaded surface is precisely the CDF. For example, as shown in the image, the probability of X being lower than or equal to 1, P(X ≤ 1), is equal to the area of the blue shaded area under the curve spanning the left-hand side of the point X = 1 in the horizontal axis. Intuitively, the larger the specific value x being observed, the higher this cumulative probability becomes, as the shaded area grows larger.

Let’s see how to calculate the CDF for a more practical example. Suppose we want to know the probability that a randomly selected adult male is 175 cm tall or shorter, that is, we look for P(Height ≤ 175). Besides assuming that your dataset of collected people measurements follows a normal distribution, a double essential requirement to know for doing the calculations is knowing the mean (average height) and standard deviation (spread of the curve) in your population. Let’s suppose these two parameters are available, and given by:

  • Mean (average height): 170 cm
  • Standard deviation (spread): 10 cm

The first computation to apply consists of standardizing the target value x, i.e. 175. Standardizing means “transforming” the normal distribution followed by your dataset into a standard normal distribution, which is a special type of normal distribution with mean = 0 and standard deviation = 1 (similar to the one in the visual example shown earlier). The standardized value, also called z-score, is calculated by this formula:

$z = \frac{x – \mu}{\sigma} = \frac{175 – 170}{10} = 0.5$

Now that we have z = 175, we can calculate the CDF upon this value. Unfortunately, this is not a straightforward manual calculation and it is normally done by using support tools like lookup tables or software tools. So, since we are interested in fast-track solutions, we will stick to these! A couple of example resources to do this are:

  • Lookup Z-table: these tables may look intimidating at first glance, but they are extremely easy to use. Just look for the row with the first decimal digit of your z-score (0.5) in the table. If you had obtained a z-score with more decimal precision, for instance z=0.51, z=0.54, or any other, check the column that matches the second decimal, otherwise just fetch the value below the first column, as shown below:
    Using a lookup table to obtain the CDF given a z-score
    Example websites where these tables are accessible include: Link 1, Link 2.
  • Coding: another option, for those into programming, makes it possible to calculate the cumulative probability sought in a single line, without the need for even manually calculating the z-score first. The following code uses scipy’s norm.cdf function to calculate it, based on three inputs: the target height x, the mean, and the standard deviation of the distribution.
from scipy.stats import norm
cdf = norm.cdf(175, loc=170, scale=10)

Regardless of the method, we obtain a value of:

$\Pr(\text{Height} \leq 175) = \Pr(Z \leq 0.5) = 0.6915$,

which indicates that 69.15% of adult males are 175 cm tall or shorter. Put another way, if we randomly picked an adult male from our population, there’d be about a 69% chance that individual would be 175 cm tall or shorter.
​

Wrapping Up

This article described in simple terms the process of calculating CDFs (cumulative distribution functions) for a variety of data scenarios where normal distributions are assumed. Mastering this method and the available tools to calculate a CDF is essential in many real-world scenarios where this kind of task arises.

Leave a Reply

Your email address will not be published. Required fields are marked *