# Rayleigh distribution

In probability theory and statistics, the Rayleigh distribution Template:IPAc-en is a continuous probability distribution for positive-valued random variables.

A Rayleigh distribution is often observed when the overall magnitude of a vector is related to its directional components. One example where the Rayleigh distribution naturally arises is when wind velocity is analyzed into its orthogonal 2-dimensional vector components. Assuming that each component is uncorrelated, normally distributed with equal variance, and zero mean, then the overall wind speed (vector magnitude) will be characterized by a Rayleigh distribution. A second example of the distribution arises in the case of random complex numbers whose real and imaginary components are i.i.d. (independently and identically distributed) Gaussian with equal variance and zero mean. In that case, the absolute value of the complex number is Rayleigh-distributed.

The distribution is named after Lord Rayleigh.{{ safesubst:#invoke:Unsubst||date=__DATE__ |$B= {{#invoke:Category handler|main}}{{#invoke:Category handler|main}}[citation needed] }} ## Definition The probability density function of the Rayleigh distribution is $f(x;\sigma )={\frac {x}{\sigma ^{2}}}e^{-x^{2}/(2\sigma ^{2})},\quad x\geq 0,$ $F(x)=1-e^{-x^{2}/(2\sigma ^{2})}$ ## Relation to random vector lengths Consider the two-dimensional vector $Y=(U,V)$ which has components that are Gaussian-distributed, centered at zero, and independent. Then $f_{U}(u;\sigma )={\frac {e^{-u^{2}/2\sigma ^{2}}}{\sqrt {2\pi \sigma ^{2}}}}$ , and similarly for $f_{V}(v;\sigma )$ . $f(x;\sigma )={\frac {1}{2\pi \sigma ^{2}}}\int _{-\infty }^{\infty }du\,\int _{-\infty }^{\infty }dv\,e^{-u^{2}/2\sigma ^{2}}e^{-v^{2}/2\sigma ^{2}}\delta (x-{\sqrt {u^{2}+v^{2}}}).$ By transforming to the polar coordinate system one has $f(x;\sigma )={\frac {1}{2\pi \sigma ^{2}}}\int _{0}^{2\pi }\,d\phi \int _{0}^{\infty }dr\,\delta (r-x)re^{-r^{2}/2\sigma ^{2}}={\frac {x}{\sigma ^{2}}}e^{-x^{2}/2\sigma ^{2}},$ which is the Rayleigh distribution. It is straightforward to generalize to vectors of dimension other than 2. There are also generalizations when the components have unequal variance or correlations. ## Properties The raw moments are given by: $\mu _{k}=\sigma ^{k}2^{\frac {k}{2}}\,\Gamma \left(1+{\frac {k}{2}}\right)$ The mean and variance of a Rayleigh random variable may be expressed as: $\mu (X)=\sigma {\sqrt {\frac {\pi }{2}}}\ \approx 1.253\sigma$ and ${\textrm {var}}(X)={\frac {4-\pi }{2}}\sigma ^{2}\approx 0.429\sigma ^{2}$ $f_{\text{max}}=f(\sigma ;\sigma )={\frac {1}{\sigma }}e^{-{\frac {1}{2}}}\approx {\frac {1}{\sigma }}0.606$ The skewness is given by: $\gamma _{1}={\frac {2{\sqrt {\pi }}(\pi -3)}{(4-\pi )^{\frac {3}{2}}}}\approx 0.631$ The excess kurtosis is given by: $\gamma _{2}=-{\frac {6\pi ^{2}-24\pi +16}{(4-\pi )^{2}}}\approx 0.245$ The characteristic function is given by: $\varphi (t)=1-\sigma te^{-{\frac {1}{2}}\sigma ^{2}t^{2}}{\sqrt {\frac {\pi }{2}}}\left[{\textrm {erfi}}\left({\frac {\sigma t}{\sqrt {2}}}\right)-i\right]$ $M(t)=1+\sigma t\,e^{{\frac {1}{2}}\sigma ^{2}t^{2}}{\sqrt {\frac {\pi }{2}}}\left[{\textrm {erf}}\left({\frac {\sigma t}{\sqrt {2}}}\right)+1\right]$ ### Differential entropy The differential entropy is given by{{ safesubst:#invoke:Unsubst||date=__DATE__ |$B= {{#invoke:Category handler|main}}{{#invoke:Category handler|main}}[citation needed] }}

$H=1+\ln \left({\frac {\sigma }{\sqrt {2}}}\right)+{\frac {\gamma }{2}}$ ## Parameter estimation

${\widehat {\sigma ^{2}}}\approx \!\,{\frac {1}{2N}}\sum _{i=1}^{N}x_{i}^{2}$ is an unbiased maximum likelihood estimate.
${\hat {\sigma }}\approx \!\,{\sqrt {{\frac {1}{2N}}\sum _{i=1}^{N}x_{i}^{2}}}$ is a biased estimator that can be corrected via the formula
$\sigma ={\hat {\sigma }}{\frac {\Gamma (N){\sqrt {N}}}{\Gamma (N+{\frac {1}{2}})}}={\hat {\sigma }}{\frac {4^{N}N!(N-1)!{\sqrt {N}}}{(2N)!{\sqrt {\pi }}}}$ ### Confidence intervals

To find the (1 − α) confidence interval, first find the two numbers $\chi _{1}^{2},\ \chi _{2}^{2}$ where:

$Pr(\chi ^{2}(2N)\leq \chi _{1}^{2})=\alpha /2,\quad Pr(\chi ^{2}(2N)\leq \chi _{2}^{2})=1-\alpha /2$ then

${\frac {N{\overline {x^{2}}}}{\chi _{2}^{2}}}\leq {\widehat {\sigma }}^{2}\leq {\frac {N{\overline {x^{2}}}}{\chi _{1}^{2}}}$ ## Generating random variates

Given a random variate U drawn from the uniform distribution in the interval (0, 1), then the variate

$X=\sigma {\sqrt {-2\ln(U)}}\,$ has a Rayleigh distribution with parameter $\sigma$ . This is obtained by applying the inverse transform sampling-method.

## Related distributions

$[Q=R^{2}]\sim \chi ^{2}(N)\ .$ $\left[Y=\sum _{i=1}^{N}R_{i}^{2}\right]\sim \Gamma (N,2\sigma ^{2}).$ ## Applications

An application of the estimation of σ can be found in magnetic resonance imaging (MRI). As MRI images are recorded as complex images but most often viewed as magnitude images, the background data is Rayleigh distributed. Hence, the above formula can be used to estimate the noise variance in an MRI image from background data.