Generate exponential random variable excel

Generating random numbers from the exponential distribution in Excel should not be such a difficult task, but the lack of a direct function does it make it difficult. In this post, you will see the steps to generate random numbers from the exponential distribution in Excel.

Generate exponential random variable excel

Understanding Exponential Distribution

The probably density function (PDF) of exponential distribution is:
f(x; lambda) = lambda * exp(-lambda * x)

where:

x is greater than or equal to zero

lambda is the rate parameter or 1/mean.

The cumulative distribution function (CDF) of exponential distribution is:

F(x; lambda) = 1 - exp(-lambda * x)

Percent Point Function (PPF) or Inverse of the cumulative distribution function, given by:

G(x) = - 1/lambda * logn(1- x)

We will use the PPF to generate exponential distribution random numbers.

Step 1: Generate Random Numbers from Uniform Distribution

  • The first step is to create a set of uniform random numbers between 0 and 1. To generate these random numbers, simple enter this following command in your Excel sheet cell A2:

=RAND()

  • Copy the formula down to A21, so that we have 20 random numbers from A2:A21.

Step 2: Calculate Mean of the Random Numbers

In a blank cell, say A22, calculate the mean of the numbers. Enter this formula:

=AVERAGE(A2:A21)

Step 2: Generate Random Numbers from Exponential Distribution

  • In cell B2, enter this formula (there is a minus sign in front of A22):

=-A22 * LN(1 - A2)

where:

LN is the natural logarithm value.

  • In the formula, make A22 absolute value by place the $ sign in front of the letter and numbers, such as $A$22.
  • Drag the formula down to B21

See this following image for an example:

Generate exponential random variable excel

There you have it: you have successfully generated random numbers in Excel from the exponential distribution.

Excel And Statistics Books You May Be Interested In:

No products found.

Last update on 2022-05-05 / Affiliate links / Images from Amazon Product Advertising API

Basic Concepts

The exponential distribution can be used to determine the probability that it will take a given number of trials to arrive at the first success in a Poisson distribution; i.e. it describes the inter-arrival times in a Poisson process. It is the continuous counterpart to the geometric distribution, and it too is memoryless.

Definition 1: The exponential distribution has the probability density function (pdf) given by

f(x) = λe-λx

for x ≥ 0. Lambda is called the rate parameter and λ > 0.

The cumulative distribution function (cdf) is

F(x) = 1 – e-λx

The inverse cumulative distribution function is

F-1(p) = – ln(1–p)/λ

Worksheet Functions

Excel Function: Excel provides the following function for the exponential distribution:

EXPON.DIST(x, λ, cum) = the pdf of the exponential function f(x) when cum = FALSE and the corresponding cumulative distribution function F(x) when cum = TRUE.

This function is not available in versions of Excel prior to Excel 2010. Instead, these versions of Excel use the equivalent function EXPONDIST.

Observation: The exponential distribution is equivalent to the gamma distribution with α = 1 and β = 1/λ. Thus, EXPON.DIST(x, λ, cum) = GAMMA.DIST(x, 1, 1/λ, cum).

There is no EXPON.INV(p, λ) function in Excel, but GAMMA.INV(p, 1, 1/λ) or –LN(1–p)/λ or the following Real Statistics function can be used instead.

Real Statistics Function: The Real Statistics Resource Pack supplies the following function.

EXPON_INV(p, λ) = the inverse of the exponential distribution at p

Graph

Figure 1 shows a graph of the pdf of the exponential distribution for λ = 1, 2 and 3.

Generate exponential random variable excel

Figure 1 – Pdf of exponential distribution

Properties

Key statistical properties are:

  • Mean = 1 / λ
  • Median = ln 2/λ
  • Mode = 0
  • Range = [0, ∞)
  • Variance = 1 / λ2
  • Skewness = 2
  • Kurtosis = 6

If λ is a constant representing the average number of random events that occur in a fixed time interval, then the probability that the first such event will occur in less than x time is given by the cumulative exponential distribution function F(x).

Property 1: An exponential distribution is memoryless

Property 2: If x has a Poisson distribution with mean λ, then the time between events follows an exponential distribution with mean 1/ λ.

Click here for the proofs of these two properties.

Examples

Click here for examples based on the exponential distribution.

Reference

Wikipedia (2012) Exponential distribution
https://en.wikipedia.org/wiki/Exponential_distribution

How do you generate a random sample from exponential distribution in Excel?

Excel Function: Excel provides the following function for the exponential distribution: EXPON. DIST(x, λ, cum) = the pdf of the exponential function f(x) when cum = FALSE and the corresponding cumulative distribution function F(x) when cum = TRUE.

How do you create an exponential random variable?

Steps involved are as follows..
Compute the cdf of the desired random variable . For the exponential distribution, the cdf is ..
Set R = F(X) on the range of . ... .
Solve the equation F(X) = R for in terms of . ... .
Generate (as needed) uniform random numbers and compute the desired random variates by..

How do you write an exponential function in Excel?

Excel has an exponential & natural log function =EXP(value) which will give us the result of value. For example, if we want to find the value of e2 x-1, where x is to be taken from cell B6 in the example, you would use the formula =EXP(2*B6-1).