Hi everybody
is there any way to use, in a Vensim model, a variable that simulates a truncated lognormal? I know how I can simulate a "full" lognormal through a normal distribution but what about the insertion of a maximum positive value? How can I rescale so that the area under the truncated disribution is still equal to 1?
All the best, thanks in advance for any suggestion.
Lorenzo
Truncated lognormal
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Truncated lognormal
The RANDOM NORMAL function generates a truncated Normal distribution, so if you transform that you'll get a truncated Lognormal. You could do something like:
randx = EXP( RANDOM NORMAL(-something large, LN(max val), LN(geometric mean), geometric SD, stream ID) )
randx = EXP( RANDOM NORMAL(-something large, LN(max val), LN(geometric mean), geometric SD, stream ID) )
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Truncated lognormal
Hi tomfidtomfid wrote: ↑Sat Oct 17, 2020 2:03 pm The RANDOM NORMAL function generates a truncated Normal distribution, so if you transform that you'll get a truncated Lognormal. You could do something like:
randx = EXP( RANDOM NORMAL(-something large, LN(max val), LN(geometric mean), geometric SD, stream ID) )
thank you a lot... fast and precise as usual
All the best.
Lorenzo
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Truncated lognormal
Hi tomfid
is it the same if I use this form?
randx = EXP( normal_mean+normal_std_dev*RANDOM NORMAL(-100, LN(max val),0, 1, 0 )
Lorenzo
is it the same if I use this form?
randx = EXP( normal_mean+normal_std_dev*RANDOM NORMAL(-100, LN(max val),0, 1, 0 )
Lorenzo
Re: Truncated lognormal
Yes, as long as LN(max val) represents the maximum departure in terms of number of geometric std dev above the mean.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Truncated lognormal
Hi tomfid
could you be more clear about this: "the maximum departure in terms of number of geometric std dev above the mean"?
Indeed I have to generate a lognormal whose normal parameters are μ = −13.3 and σ = 3.49 truncated on the interval [0, 2.35 × 10−3]).
Lorenzo
could you be more clear about this: "the maximum departure in terms of number of geometric std dev above the mean"?
Indeed I have to generate a lognormal whose normal parameters are μ = −13.3 and σ = 3.49 truncated on the interval [0, 2.35 × 10−3]).
Lorenzo
Re: Truncated lognormal
That would be:
EXP( RANDOM NORMAL(-100,-6.05,-13.3,3.49,stream) )
where -6.05 = ln(2.35e-3)
The -100 is just a big number (30 standard deviations roughly) - the truncation at 0 isn't really needed since the lognormal is always >0.
EXP( RANDOM NORMAL(-100,-6.05,-13.3,3.49,stream) )
where -6.05 = ln(2.35e-3)
The -100 is just a big number (30 standard deviations roughly) - the truncation at 0 isn't really needed since the lognormal is always >0.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Truncated lognormal
Hi tomfid
thank you a lot.
All the best.
Lorenzo