Model CDF without a closed-form solution

Use this forum to post Vensim related questions.
Post Reply
WayneZhou2009
Senior Member
Posts: 105
Joined: Wed Oct 25, 2017 3:52 pm
Vensim version: PRO

Model CDF without a closed-form solution

Post by WayneZhou2009 »

Hi Tom and everyone,

This might be trivial. However I searched the forum and did not find the answer to it. I am trying to model the cumulative distribution function (CDF) and hazard function of certain distributions that do not have analytical expressions (closed form solutions).

The background is that I want to model the discard rate of my products per year. For example, I have 100 new products in 2018 and their lifetimes are assumed to follow a given distribution, say, normal distribution. In 2019, I have another 150 new products and their lifetimes follow the same distribution. And so on. The distribution remains unchanged, regardless of TIME. In other words, the hazard rate consists of a number of constant values, e.g. 0.02 for 1-year-old product, 0.025 for 3-year-old product, and so on. A 3-year-old product has the same risk of discard, no matter whether it is produced in 2018 or 2028. So it is not about Vensim's built-in random functions that return random numbers.

Now, if the distribution has a closed form solution for its CDF, the hazard function can be easily defined. For example, for Weibull distribution, the hazard function is given by h(x) = (shape/scale)*(x/scale)^(shape-1), where x is the age of product.

However, if the distribution does not have a closed form solution for its CDF, then how to realize the above in Vensim? An example is normal distribution, or lognormal distribution. Note that I do not want to use a lookup or get Excel constants, because I want to be able to change the parameters of the distribution within the model so that its hazard function can vary accordingly. I understand that a lookup is "fixed" once it is defined. (Please correct me if I am mistaken).

I am aware of the Delay Profile function but it uses the lookup to define the profile, hence it is not what I need. Would some sort of approximation of the CDF in a closed-form expression be the only way to go?

Thank you so much.
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Model CDF without a closed-form solution

Post by Administrator »

My "stats" is not so strong. Does the following help?
http://metasd.com/2010/05/cumulative-no ... tribution/

or

viewtopic.php?t=3438
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
WayneZhou2009
Senior Member
Posts: 105
Joined: Wed Oct 25, 2017 3:52 pm
Vensim version: PRO

Re: Model CDF without a closed-form solution

Post by WayneZhou2009 »

Hi Administrator,

Many thanks for your quick response. Yes I did come across the second one, i.e. viewtopic.php?t=3438 . So, it appears that using a closed-form expression to approximate the CDF is the way out? I am concerned about the accuracy of the results of this method.

I wonder if it is possible to sort of "integrate" the PDF into the CDF in Vensim. However, this integration is different from the conventional way of integrating flows into a level in Vensim, where the flow and the level are time variant. Here in my case, the CDF needs to be invariant over real time (year 2018, 2019, 2020, and so on), as it only applies to a product's age ( 1-year-old, 2-year-old, and so on). To describe it in another way, the CDF profile (and the derived hazard profile) is cross-sectional, but not time-series.

Any thoughts and enlightenment are greatly appreciated.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Model CDF without a closed-form solution

Post by tomfid »

Note that the NORMAL CDF macro is now built-in to Vensim. The numerical approximation is quite precise; I think it would be rare to find a case where any error was meaningful relative to other uncertainties in the model.

For other distributions, you could write an external function.
WayneZhou2009
Senior Member
Posts: 105
Joined: Wed Oct 25, 2017 3:52 pm
Vensim version: PRO

Re: Model CDF without a closed-form solution

Post by WayneZhou2009 »

Hi Tom,
Many thanks. I did not know there is a NORMAL CDF function available now in Vensim. Just found in my Vensim (version 7.1). But it does not appear to be covered in Vensim Help? Please could you let me know where more details about this function.

Thanks.
tomfid wrote:Note that the NORMAL CDF macro is now built-in to Vensim. The numerical approximation is quite precise; I think it would be rare to find a case where any error was meaningful relative to other uncertainties in the model.

For other distributions, you could write an external function.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Model CDF without a closed-form solution

Post by tomfid »

It's based on the macro from MetaSD that Tony linked - same inputs.

I'll add it to the help.
LAUJJL
Senior Member
Posts: 1421
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Model CDF without a closed-form solution

Post by LAUJJL »

Hi

A lookup is not fixed and you can vary it using the vector lookup formula.

See the model joined.

Regards.

JJ
Attachments
lookup.vpm
(15.73 KiB) Downloaded 229 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Model CDF without a closed-form solution

Post by tomfid »

Correct, but you can't use VECTOR LOOKUP with DELAY PROFILE.
WayneZhou2009
Senior Member
Posts: 105
Joined: Wed Oct 25, 2017 3:52 pm
Vensim version: PRO

Re: Model CDF without a closed-form solution

Post by WayneZhou2009 »

Thank you both so much, Tom and LAUJJL !
Post Reply