10

The formula for the probability density function of a standard normal distribution that isn't skewed is: $$P(x) = \frac{1}{\sqrt{2π}}e^{-(x^2 / 2)}$$ where, $π = 3.14, e = 2.718$.

What if it is skewed left or right like this: What is the formula for the standard normal distribution after it's been skewed.

If anyone is wondering I'm asking because I need the formula for a program I'm writing where certain 'effects' are strong in the beginning and weaker towards the end or weak at the beginning and stronger towards the end. If this doesn't make sense just forget it.

Jimmy R.
  • 35,868
Hauzron
  • 205
  • Your question makes sense. However, your requirements can be met by other native skewed distributions like the lognormal, or the exponential distribution or by the $xe^x$ ($x\ge $0) distribution, or you could design a pdf function by taking straight lines of different slope. But make sure that the integral of the composition is 1. Otherwise it is meaningless to take a distribution if you have no input regarding the behavior of the phenomena to be described. – zoli Feb 01 '15 at 10:01
  • @zoli There is indeed something we call skewed normal distribution that is often used in finance (see my answer). – flawr Feb 01 '15 at 10:26

1 Answers1

12

The skewed normal distribution is defined as follows:

Let $\phi(x) := \frac{1}{\sqrt{2\pi}} e^{-\frac 1 2 x^2}$ be the PDF of the standard normal distribution.

Let $\Phi(x) := \int_{-\infty}^x \phi(t) dt$ the corressponding CDF.

Then we can define the PDF of the skewed normal distribution with a skewnessparameter $a$ as

$$f_a(x) = \frac{\phi(x)\Phi(ax)}{\Phi(0)} \qquad (*)$$

You can show that $\int_{-\infty}^{\infty} f_a(x) dx = 1 \forall a\in \mathbb R$

If you look at plots you will easily see, that $f_a$ is left skewed for positive $a$ and right skewed for negative $a$.

If you want to shift the distribution about $u$ for adjusting the mean, you can just use $x \mapsto f_a(x-u)$. If you want to adjust the variance you can just use $x \mapsto \frac{1}{s} f_a\left(\frac{x}{s}\right)$ (or a combination of both).

These are the plots of $\color{blue}{f_0}, \color{green}{f_1},\color{red}{f_3}, \color{#0aa}{f_{15}}$:

plots

$(*):$ This idea works also for other distributions, in your case you can replace $\phi,\Phi$ with the correspoding PDF/CDF of the cauchy, student-t, slash etc...

flawr
  • 16,533
  • 5
  • 41
  • 66
  • thank you for this answer. I'm trying to write a function to calculate the CDF of a skewed normal distribution, but since I'm a programmer, and not a mathematician - your explanation is *way* over my head. Can you point me to an algorithm (any language) that implements this formula? Thanks in advance! – mattstuehler Nov 09 '16 at 20:00
  • First off: Calculating the CDF is unfortunately not so straightforward. Do you already have a builtin CDF of the normal distribution? The problem is, that you already cannot express $\Phi$ in elementary functions (like $\sin, \cos,\log$ e.t.c), and you cannot express the CDF of the sqewed distribution in elementary functions even more so. Can you tell me what system/language you're working in? – flawr Nov 09 '16 at 21:17
  • Ultimately - I'd like to use JavaScript. But I'm reasonably familiar with some other languages like C, C++, C#, php, etc, so any of those might work. I do have a CDF function for the normal distribution, adapted from "Numerical Recipes in C (http://numerical.recipes/). – mattstuehler Nov 09 '16 at 21:54
  • Then the easiest thing to do (assuming we can use the CDF of the normal distribution) would probably be using some kind of numerical integration (also know as numerical quadrature) to evaluate the CDF of the skew-normal distribution. Can you limit $a$ to a certain interval? Or can you say to what accuracy you want to evaluate the CDF? – flawr Nov 09 '16 at 22:00
  • 2
    I just did a quick search: It appears that the CDF of the skew-normal-dist. has been implemented in some languages. Depending on the accuracy you need, you might also want to use this approximation. – flawr Nov 09 '16 at 22:06
  • First - thank you for your time, and those links! Diving into both now. Wish me luck! – mattstuehler Nov 09 '16 at 22:12