Rayleigh Distribution: Definition, Formulas, and More

Normal, t-Student, Uniform, and similar distributions are some of the most well-known and commonly used in probability and statistics. Their popularity is due to their many applications and easy-to-follow formulas. However, less well-known distributions, such as the Rayleigh distribution, still have some applications and are worth learning about.

The Rayleigh distribution is a continuous probability distribution. It is an example of a one-parameter probability distribution and a special case of the Weibull distribution when k, the shape parameter, equals 2. The distribution is named after the English mathematician and physicist Lord Rayleigh.

The Rayleigh distribution often describes the magnitude of a vector in a plane based on its directional components. For instance, when analyzing two-dimensional wind velocity with uncorrelated, normally distributed components of equal variance and zero mean, the overall wind speed follows a Rayleigh distribution.

In this post, I will present the Rayleigh distribution's probability density function (PDF) and cumulative distribution function (CDF). I will also provide formulas for its mean, variance, and other moments, concluding with R code to generate numbers from the Rayleigh distribution and plot them. Let’s begin!

Definition

As mentioned earlier, the Rayleigh distribution is a continuous probability distribution with a single parameter. Continuous probability distributions can be represented by a probability density function (PDF) and a cumulative distribution function (CDF), which represents the probability of a random variable being less than or equal to a given value. Both functions depend on the random variable and the parameter.

The PDF of the Rayleigh distribution is given by the formula:

Formula 1. The probability density function (PDF) f of the Rayleigh distribution with scale parameter σ.

For a better understanding of the formula, below is a graph of several different Rayleigh distribution density functions:

Image 1. The probability density function (PDF) of the Rayleigh distribution for different values of the parameter σ.

The Rayleigh distribution’s CDF has the formula equal to:

Formula 2. The cumulative distribution function (CDF) F of the Rayleigh distribution with scale parameter σ.

Similarly to the PDF, below is a plot of different Rayleigh distribution CDFs:

Image 2. The cumulative distribution function (CDF) of the Rayleigh distribution for different values of the parameter σ.

As you can see, this distribution applies only to nonnegative values. Therefore, it can be useful for modeling insurance losses, which are also nonnegative. Other distributions commonly used for modeling losses include the log-normal and Pareto distributions, but more on that in future posts.

Now that we know the formulas for the PDF and CDF of the Rayleigh distribution, let’s move on to the formulas for its mean, variance, and moments.

Formulas

Remembering the formulas for expected value, variance, and other raw or central moments from a few probability distributions can be quite an asset during quiz games. Still, it’s a real advantage when taking actuarial exams.

For example, if you know the formula for the variance of an exponential distribution and the parameter λ of the distribution, you can find the answer right away. If not, you’ll need to calculate the first and second raw moments by integrating the PDF before arriving at the answer. The same applies to the Rayleigh distribution.

I will show the formulas for the expected value and variance, as well as a general formula for raw moments, which is a true gift for actuarial geeks like me who are preparing for exams! In each formula, the random variable X follows a Rayleigh distribution with scale parameter σ.

Mean and Variance

The mean (expected value) of the Rayleigh distribution is given by the formula:

and the variance, which is the difference between the second raw moment and the square of the first moment, is given by the formula:

You might say that these formulas look strange because they involve ππ in some way. I agree—when I first saw them, this was my concern as well. However, I then found a more general formula for the raw moments of this distribution, and it became clear. Let’s take a look at this formula.

Moments

In the Rayleigh distribution, the k-th raw moment is given by the formula:

Formula 3: The k-th raw moment of the Rayleigh distribution.

To check if the formula for the first-order raw moment, which is the expected value, matches this general formula, let’s set k=1 and calculate the result:

The value is the same as the one from the expected value formula presented earlier.

Rayleigh Distribution in R

Lastly, I want to share a sample code with you to visualize the Rayleigh distribution in R.

To plot values from this distribution, we first need to install the bayesmeta package. I’ve specified three different values for σ at the beginning of the code, but these can also be specified directly in the given function.

Feel free to copy this code and experiment with it! I think it’s a great way to understand the distribution and improve your R programming skills.

At the bottom of this page, you’ll find a link to the R documentation with more information about Rayleigh distribution-related functions.

#Install packages

install.packages("bayesmeta")
library(bayesmeta)

#Define scale parameters

sigma_1 <- 2
sigma_2 <- 4
sigma_3 <- 6

#Plot densities

x <- seq(0,10,le=200)
plot(x, drayleigh(x, scale=sigma_1), type="l", col="darkgreen",
     xlab=expression(x), ylab=expression("probability density " *f(x)))
lines(x, drayleigh(x, scale=sigma_2), col="red")
lines(x, drayleigh(x, scale=sigma_3), col="blue")
abline(h=0, v=0, col="grey")

#Add legend to the plot

legend("topright", 
       legend = c(2,4,6), 
       col = c("darkgreen", "red", "blue"), 
       lty = 1, 
       title = "Scale Parameters")

Image 3. R plot of the Rayleigh distribution for three different scale parameters specified in the code.

Summary

The Rayleigh distribution is a continuous probability distribution with a single parameter, the scale parameter σ. It is a special case of the Weibull distribution. Often used to describe the magnitude of a vector in a plane based on its directional components, it can also be applied to modeling insurance losses in actuarial work due to its nonnegative values.

Understanding the basic statistics of various distributions helps recognize patterns in data and tackle actuarial exam problems. Particularly useful is the formula for the raw moments of the Rayleigh distribution, which simplifies the computation of complex integrals.

I hope you found this post informative! Have you heard of the Rayleigh distribution before? Do you know of any lesser-known probability distributions that you think are interesting? Let me know in the comments below or message me—I’d love to hear from you!

Finally, at the bottom of this post, I’ve included three links for further exploration of the Rayleigh distribution and its applications in R.


Rayleigh Distribution by ScienceDirect - https://www.sciencedirect.com/topics/engineering/rayleigh-distribution

Rayleigh Distribution: Definition, Uses, Mean, Variance by Statistics How To - https://www.statisticshowto.com/rayleigh-distribution/

R Documentation: The Rayleigh distribution - https://search.r-project.org/CRAN/refmans/bayesmeta/html/drayleigh.html

Previous
Previous

Make Your (New Year's) Resolutions Count: My Personal Guide to Success

Next
Next

Write It Down - Study Tip #3