[Math] How to draw the skewed normal distribution curve

meansmediannormal distribution

If its of real importance, I am trying to plot the data on gnuplot.
I have the following of some experimental data, obtained by octave:

  • mean: $\overline{\mu} = 0.6058$
  • median: $\tilde{\nu} = 0.6364$
  • std: $\sigma_x = 0.1674$
  • variance: $\sigma^2 = 0.028$
  • skewness $= 0.3131$

I am trying to plot them, but AFAIK, the normal distribution does not account for skewness (left or right).
I am using the typical Gaussian curve function:

$f(x) = \frac{1}{\sigma_x \cdot \sqrt{2 \pi}} e^{- \frac{(x-\mu)^2}{2\sigma^2}}$

How can I account the change in the curve shape, for my given skewness?
For this data-set it is obvious that there exists a difference from median to mean, and I would like to plot that.

Best Answer

You can use the skew normal distribution with parameters $(ξ,ω,α)$ which can be estimated from the given data. If we set $δ=\dfrac{α}{\sqrt{1+α^2}}$, then the mean, variance and skewness of the skew normal distribution are given by (see the link)

  1. mean: $ξ+ωδ\sqrt{\dfrac2π}$
  2. variance: $ω^2\left(1-\dfrac{2δ^2}{π}\right)$
  3. skewness: $\dfrac{4-\pi}{2} \dfrac{\left(\delta\sqrt{\dfrac2\pi}\right)^3}{ \left(1-\dfrac{2\delta^2}{\pi}\right)^{3/2}}$

Substitute your known values for the mean, variance and skewness to find proper values for the parameters $(ξ,ω,α)$ of the distribution. Approximate values will do (you do not need to solve exactly), because you are based on a sample, and the distribution that you will find does not need to fit exactly to the sample. So, trial and error (with a computer), may help, since this is not an easy to solve system.


Start from the formula of the skewness which depends only on $δ$. That is solve

$$0.3131=\dfrac{4-\pi}{2} \dfrac{\left(\delta\sqrt{\dfrac2\pi}\right)^3}{ \left(1-\dfrac{2\delta^2}{\pi}\right)^{3/2}}$$ to find (approximately $δ$). From $δ$ you can find directly $α$. Now, go to the variance and solve $$0.028=ω^2\left(1-\dfrac{2δ^2}{π}\right)$$ to find $ω$. Use the value for the $δ$ that you already have. Finally, use the formula for the mean (with $ω, δ$ known) to find $ξ$ in a similar way.