The folded normal distribution is a probability distribution related to the normal distribution. Given a normally distributed random variable X with mean μ and variance σ2, the random variable Y = |X| has a folded normal distribution. Such a case may be encountered if only the magnitude of some variable is recorded, but not its sign. The distribution is called "folded" because probability mass to the left of x = 0 is folded over by taking the absolute value. In the physics of heat conduction, the folded normal distribution is a fundamental solution of the heat equation on the half space; it corresponds to having a perfect insulator on a hyperplane through the origin.
Definitions
Density The probability density function (PDF) is given by
fY(x;μ,σ2)=12πσ2e−(x−μ)22σ2+12πσ2e−(x+μ)22σ2 for x ≥ 0, and 0 everywhere else. An alternative formulation is given by
f(x)=2πσ2e−(x2+μ2)2σ2cosh(μxσ2), where cosh is the Hyperbolic cosine function. It follows that the cumulative distribution function (CDF) is given by:
FY(x;μ,σ2)=12[erf(x+μ2σ2)+erf(x−μ2σ2)] for x ≥ 0, where erf() is the error function. This expression reduces to the CDF of the half-normal distribution when μ = 0. The mean of the folded distribution is then
μY=σ2πexp(−μ22σ2)+μerf(μ2σ2) or
μY=2πσe−μ22σ2+μ[1−2Φ(−μσ)] where Φ is the normal cumulative distribution function:
Φ(x)=12[1+erf(x2)]. The variance then is expressed easily in terms of the mean:
σY2=μ2+σ2−μY2.
Properties
Mode The mode of the distribution is the value of x for which the density is maximised. In order to find this value, we take the first derivative of the density with respect to x and set it equal to zero. Unfortunately, there is no closed form. We can, however, write the derivative in a better way and end up with a non-linear equation df(x)dx=0⇒−(x−μ)σ2e−12(x−μ)2σ2−(x+μ)σ2e−12(x+μ)2σ2=0 x[e−12(x−μ)2σ2+e−12(x+μ)2σ2]−μ[e−12(x−μ)2σ2−e−12(x+μ)2σ2]=0 x(1+e−2μxσ2)−μ(1−e−2μxσ2)=0 (μ+x)e−2μxσ2=μ−x x=−σ22μlogμ−xμ+x.
Tsagris et al. (2014) saw from numerical investigation that when μ<σ, the maximum is met when x=0, and when μ becomes greater than 3σ, the maximum approaches μ. This is of course something to be expected, since, in this case, the folded normal converges to the normal distribution. In order to avoid any trouble with negative variances, the exponentiation of the parameter is suggested. Alternatively, you can add a constraint, such as if the optimiser goes for a negative variance the value of the log-likelihood is NA or something very small.
Characteristic function and other related functions The characteristic function is given by φx(t)=e−σ2t22+iμtΦ(μσ+iσt)+e−σ2t22−iμtΦ(−μσ+iσt).
The moment generating function is given by Mx(t)=φx(−it)=eσ2t22+μtΦ(μσ+σt)+eσ2t22−μtΦ(−μσ+σt).
The cumulant generating function is given by Kx(t)=logMx(t)=(σ2t22+μt)+log{1−Φ(−μσ−σt)+eσ2t22−μt[1−Φ(μσ−σt)]}.
The Laplace transformation is given by E(e−tx)=eσ2t22−μt[1−Φ(−μσ+σt)]+eσ2t22+μt[1−Φ(μσ+σt)].
The Fourier transform is given by f̂(t)=φx(−2πt)=e−4π2σ2t22−i2πμt[1−Φ(−μσ−i2πσt)]+e−4π2σ2t22+i2πμt[1−Φ(μσ−i2πσt)].
Related distributions When μ = 0, the distribution of Y is a half-normal distribution. The random variable (Y/σ)2 has a noncentral chi-squared distribution with 1 degree of freedom and noncentrality equal to (μ/σ)2. There is a bivariate version developed by Psarakis and Panaretos (2001) as well as a multivariate version developed by Chakraborty and Chatterjee (2013). The Rice distribution is a multivariate generalization of the folded normal distribution.
Statistical inference
Estimation of parameters There are a few ways of estimating the parameters of the folded normal. All of them are essentially the maximum likelihood estimation procedure, but in some cases, a numerical maximization is performed, whereas in other cases, the root of an equation is being searched. The log-likelihood of the folded normal when a sample xi of size n is available can be written in the following way l=−n2log2πσ2+∑i=1nlog[e−(xi−μ)22σ2+e−(xi+μ)22σ2] l=−n2log2πσ2+∑i=1nlog[e−(xi−μ)22σ2(1+e−(xi+μ)22σ2e(xi−μ)22σ2)] l=−n2log2πσ2−∑i=1n(xi−μ)22σ2+∑i=1nlog(1+e−2μxiσ2)
In R (programming language), using the package Rfast one can obtain the MLE really fast (command foldnorm.mle). Alternatively, the command optim or nlm will fit this distribution. The maximisation is easy, since two parameters (μ and σ2) are involved. Note, that both positive and negative values for μ are acceptable, since μ belongs to the real line of numbers, hence, the sign is not important because the distribution is symmetric with respect to it. The next code is written in RThe partial derivatives of the log-likelihood are written as ∂l∂μ=∑i=1n(xi−μ)σ2−2σ2∑i=1nxie−2μxiσ21+e−2μxiσ2 ∂l∂μ=∑i=1n(xi−μ)σ2−2σ2∑i=1nxi1+e2μxiσ2 and ∂l∂σ2=−n2σ2+∑i=1n(xi−μ)22σ4+2μσ4∑i=1nxie−2μxiσ21+e−2μxiσ2 ∂l∂σ2=−n2σ2+∑i=1n(xi−μ)22σ4+2μσ4∑i=1nxi1+e2μxiσ2. By equating the first partial derivative of the log-likelihood to zero, we obtain a nice relationship ∑i=1nxi1+e2μxiσ2=∑i=1n(xi−μ)2. Note that the above equation has three solutions, one at zero and two more with the opposite sign. By substituting the above equation, to the partial derivative of the log-likelihood w.r.t σ2 and equating it to zero, we get the following expression for the variance σ2=∑i=1n(xi−μ)2n+2μ∑i=1n(xi−μ)n=∑i=1n(xi2−μ2)n=∑i=1nxi2n−μ2, which is the same formula as in the normal distribution. A main difference here is that μ and σ2 are not statistically independent. The above relationships can be used to obtain maximum likelihood estimates in an efficient recursive way. We start with an initial value for σ2 and find the positive root (μ) of the last equation. Then, we get an updated value of σ2. The procedure is being repeated until the change in the log-likelihood value is negligible. Another easier and more efficient way is to perform a search algorithm. Let us write the last equation in a more elegant way 2∑i=1nxi1+e2μxiσ2−∑i=1nxi(1+e2μxiσ2)1+e2μxiσ2+nμ=0 ∑i=1nxi(1−e2μxiσ2)1+e2μxiσ2+nμ=0. It becomes clear that the optimization the log-likelihood with respect to the two parameters has turned into a root search of a function. This of course is identical to the previous root search. Tsagris et al. (2014) spotted that there are three roots to this equation for μ, i.e. there are three possible values of μ that satisfy this equation. The −μ and +μ, which are the maximum likelihood estimates and 0, which corresponds to the minimum log-likelihood.
… excerpt ends here. Continue reading the full article.


