Hi,
does anybody know how to calculate values of the CDF (cummulative distribution function) of a standard normal distributed variable in Vensim? I need to know the probability that a standard normal distributed variable does not exceed a certain value. Can I calculate the inverse function somehow?
Thank you,
Marco
CDF-Function
Hi
The solution is to integrate the probabilities into a level.
It is not necessary to inverse that function.
The solution is to calculate a penalty function that will be for instance equal to -1000000
if the level is greater than the value not to be exceeded and to maximize the function equal
to the level plus the penalty. It is better that the objective function has a derivative that has the same value on both side of the function to maximize when the penalty is equal to -1000000. I experienced sometimes problems with the optimizer when the objective function had no derivative and was only continuous for example.
Regards.
JJ
The solution is to integrate the probabilities into a level.
It is not necessary to inverse that function.
The solution is to calculate a penalty function that will be for instance equal to -1000000
if the level is greater than the value not to be exceeded and to maximize the function equal
to the level plus the penalty. It is better that the objective function has a derivative that has the same value on both side of the function to maximize when the penalty is equal to -1000000. I experienced sometimes problems with the optimizer when the objective function had no derivative and was only continuous for example.
Regards.
JJ
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
This is the type of thing you can use google to find. The following link has an approximation (I don't know how good it is)
http://www.isye.gatech.edu/~christos/30 ... normal.pdf
http://www.isye.gatech.edu/~christos/30 ... normal.pdf
Hi Marco,
I think what you need is more like this:
Many spreadsheet programs like Excel provide built-in functions for the cumulative (standard) normal distribution and its inversion. You could use them to generate a distribution table and build a lookup in Vensim based on this.
Another possibility, if you prefer sparse solutions: Generate a table in Excel as before and fit an S-shaped function which serves as an approximation well enough for your purpose. One candidate could be the CDF of the logistic distribution. With mean = 0 it looks like this:
P = 1 / (1 + exp(-x/b))
where P is the cumulative probability and x is the variable of interest.
I fitted it to the standard normal distribution for x in [-10;10] and found that it gives a fair approximation for b = 0,5861. However, it's heavier at the tails and you have to compare and decide if such a bias is o.k. for your purpose.
This function is easy to invert:
x = -ln(1/P-1)/b
Be careful to feed it only P's from the interval ]0;1[.
By the way, another candidate is the Weibull distribution.
Greetings
Peter
I think what you need is more like this:
Many spreadsheet programs like Excel provide built-in functions for the cumulative (standard) normal distribution and its inversion. You could use them to generate a distribution table and build a lookup in Vensim based on this.
Another possibility, if you prefer sparse solutions: Generate a table in Excel as before and fit an S-shaped function which serves as an approximation well enough for your purpose. One candidate could be the CDF of the logistic distribution. With mean = 0 it looks like this:
P = 1 / (1 + exp(-x/b))
where P is the cumulative probability and x is the variable of interest.
I fitted it to the standard normal distribution for x in [-10;10] and found that it gives a fair approximation for b = 0,5861. However, it's heavier at the tails and you have to compare and decide if such a bias is o.k. for your purpose.
This function is easy to invert:
x = -ln(1/P-1)/b
Be careful to feed it only P's from the interval ]0;1[.
By the way, another candidate is the Weibull distribution.
Greetings
Peter
Hi,
when I posted my reply to Marco, I didn't notice that Bob had already answered. My post is not meant to be a comment to Bob.
Just for curiosity I just tested the function from the link Bob mentioned. The approximation seems to be very good for most practical purposes (the first three digits after the decimal point mostly match), in any case less biased than my quick-and-dirty approximation.
Greetings
Peter
when I posted my reply to Marco, I didn't notice that Bob had already answered. My post is not meant to be a comment to Bob.
Just for curiosity I just tested the function from the link Bob mentioned. The approximation seems to be very good for most practical purposes (the first three digits after the decimal point mostly match), in any case less biased than my quick-and-dirty approximation.
Greetings
Peter