Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] inverse of the cumulative normal distribution (inverse erf) (probability distribution)

Author
Message
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 8th May 2010 04:55 Edited at: 9th May 2010 00:21
This function was really annoying to figure out how to get working. Basically... This is the normal distribution, equation:

graph:

Used for probability. Basically, the probability of a point being at a given x is y. Now... for that to be really useful, you need to find the inverse of the sum. This is where problems arise, because it's a non-elementary function (IE not able to be described in something nice like 5x*2^-x or whatever)
here is the graph of the cumulative normal distribution (the sum of the normal distribution at a given x)

Right, now her8e is the inverse of the cumulative normal function (solving for x, basically)

Wow. Right. So, really complicated calculus n stuff way over my head ATM, so, I turned to the internet, and found some equations, and wired 'em together to solve for the above graph. This is, of course, an estimation, because the whole thing is... blah.
Here's the code:


You need a log() function to calculate this. You can either use IanM's matrixutils, or the ln() function I posted earlier (matrixutils would be better).

So... how is this function useful at all? I'll show you!!!
Say you want a point with the probability of being at any given x as defined by the normal distribution (first graph). Well... I'll give you that point!



still not sold? Check this out:

it creates a strip of white lines, more dense at the middle, less dense at the edges.

Bon appétit!

[edit]
and an image showing an implementation visually



Login to post a reply

Server time is: 2024-04-19 15:59:06
Your offset time is: 2024-04-19 15:59:06