need help..

Use this forum to post Vensim related questions.
Post Reply
Nesli
Member
Posts: 21
Joined: Tue Jan 18, 2011 11:33 am

need help..

Post by Nesli »

Hi, i am doing phd in Leeds University and my topic is related to waste management. I am using Vensim PLE as a method.
I built a model (as attached) but having some troubles which is like having Population Stock negative under some certain set of data. Here it is:

The aim is to make an estimation on the number of workers whose health is badly affected by the emissions released by incineration/landfill plants where they work for. My literature view showed that frequencies of some certain incidences (respiratory problems, diarrhea,dermatologic problems, cancer, cancer mortality) are high among the workers than any non-exposed societies. This increase is literately measured by "RR relative risk". Basically:

RR=frequency of incidence-A in exposed population / frequency of incidence-A in non-exposed pop
(I have the RRs of incidences from the literature view) (RR>1)
frequency of exposed pop = incidences in exposed pop/total pop
frequency of non-exposed pop = incidences in non exposed pop/total pop
(I gathered the frequencies of incidences for non-exposed population from Health Ministry statistics)

The variables in red mean that each time I anayse one particular incidence, I need to update these red auxilaries' values for each new incidence.
There is basically no immunity, so "recovery" enters susceptible's stock back again.
As I aim to estimate "additionally" affected number of workers,I seperated these rates by saying normal and additional.
Time period is 25 years (300 months) as a period of working untill getting retired is 25 years approximately and I assume that once a worker starts to work, he never changes his work/location and stay till 25 year is over.

You will see "DELAY" function..it is because workers only get affected after some time of being exposed to these emissions.

When I run the model, I observe that if I increase "frequency of morbidity due to that incidence in non-exposed pop", there are negative numbers appear for population which is nonsense..
Although I'd interpret this case as all people in that stock gets infected, it technically does not reflect this, i think?..

Do yo think that additional morbidity and additional mortality rates would give me the results I wanted??. If I export the results to excel sheet and sum them up separately then I would get I seek, i suppose?..

Thanks for any comment in advance
Nesli
Attachments
nesli[1].mdl
(6.65 KiB) Downloaded 263 times
LAUJJL
Senior Member
Posts: 1426
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: need help..

Post by LAUJJL »

Hi Nesli

Two remarks

It is better to start with a simpler model. The bugs are easier to understand with a smaller model. It is always possible to make a model more complex later on if necessary. if you had done this, you would not need any help.

You use fixed delays incorrectly. Generally fixed delays links an input rate to an output rate and not a stock to a rate.
You link a level to a rate with the traditionnal first order exponential output rate. So you are mixing both methods: fixed delay and exponential decay rate.
You have to chose between them and know why you chose one and not the other and then adapt the model to your choice.
It might be better to first try the much simpler to program exponential output (output rate = level / time to be infected or die) and then if you are not satisfied with the results try the other one.

If you use the delay fixed, the additional morbidity should be linked to the initial worker population and to the additional recovery.
Same for the additional mortality. But it is dangerous to use for one output an exponential decay and for the other a delay fixed, because you must verify that the sum of both output does not exceed the level. This is probalby why the population goes negative.

One other remark; it is not a good idea to think in frequency. The frequency should be changed into a time constant corresponding to the average time it takes for someone to be infected. you will then compute the output rate by dividing the rate by a time constant and not multiplying it by a frequency.
Regards.
JJ
Nesli
Member
Posts: 21
Joined: Tue Jan 18, 2011 11:33 am

Re: need help..

Post by Nesli »

Thank you so much indeed..

Regarding frequencies, I modified them by converting to average time it takes for somebody to be infected/died..

Regarding delays: you were quite right by saying that the sum of 2 outputs exceeds the level, thats why the level goes negative..
I suppose that I cannot use exponential decay because it should take sometime for workers to be exposed emissions and then extra cases should appear. Up until that time additional affected worker number should be 0. If I use Delay Fixed function, I think that I could show this pattern by output graphs in the end. In this case I thought I could combine additional cases with normal cases by using only one output rate (morbidity) and this rate could be defined by Delay-fixed function (same for mortality). This function appears to be as below, as far as I could think:

DELAY FIXED(increase in morbidity* (recovery+initial worker population/"average time for morbidity") , delay for morbidity to increase , initial worker population/"average time for morbidity")

so, what do you think?
Many thanks..
Regards
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: need help..

Post by tomfid »

One other remark; it is not a good idea to think in frequency. The frequency should be changed into a time constant corresponding to the average time it takes for someone to be infected. you will then compute the output rate by dividing the rate by a time constant and not multiplying it by a frequency.
I agree that there are pitfalls to thinking in terms of the frequency of discrete events. However, I often use "frequentist" equations. For example,

Code: Select all

Capital = INTEG( investmentRate - depreciationRate, initCapital )
depreciationRate = Capital*fractionalDiscardRate
It's equivalent to write

Code: Select all

depreciationRate = Capital/capitalLifetime
where capitalLifetime = 1/fractionalDiscardRate. In fact I would probably write the equation the 2nd way most of the time.

However, if you want to test a case with no depreciation, i.e. fractionalDiscardRate = 0, you can't do it with the capitalLifetime formulation, because you can't express 1/0=infinity (though you can get "close enough" by setting lifetime to a large value).

Also, the fractionalDiscardRate variant is the coefficient you'd want if you're linearizing your model, and might also be closer to the way people think about things in some fields.

Tom
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: need help..

Post by tomfid »

JJ is correct that you should stay away from DELAY FIXED and other discrete delays in this kind of model. Your

If there is a delay between exposure, development of symptoms, and death, then you should represent that process explicitly in your stock-flow structure.

For example, you might have:

[health workers] -> exposure rate -> [exposed workers] -> sickness rate -> [sick workers] -> mortality rate

(where the items in [ ] are stocks).

Tom
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: need help..

Post by tomfid »

Chapter 9 of Sterman's Business Dynamics is very good on this topic.
Nesli
Member
Posts: 21
Joined: Tue Jan 18, 2011 11:33 am

Re: need help..

Post by Nesli »

JJ and Tom, Many thanks...

I tried to apply your ideas and modified the model (as attached). I hope this time I employed the functions correctly..Any ideas appreciated..

Nesli
Attachments
try2.mdl
(3.38 KiB) Downloaded 258 times
LAUJJL
Senior Member
Posts: 1426
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: need help..

Post by LAUJJL »

Hi Nesri
There is still a bug in your model.
If you set average time for mortality to 1 month and average treatment time to 1 month too, sick workers start to oscillate more and more above and below zero. A population cannot go negative.
You should change the formulation of mortality and recovery to avoid sick workers going negative.
I think that as Tom said you may use the frequency formulation in this particular case, because the time to die and the time to be cured is ambiguous. What happens exactly? If the time to be cured is equal to one month on average and the time to die is equal to 3 months, the only person who die are the one that did not get cured in a three months period?
Using a frequency is much clearer. It may come from the observation that a certain percentage of people sick die and another get cured. This formulation is clearer although less explicative than the one with time to die and to recover. If you want to use the more explicit time to die and to recover, to my opinion one must explain exactly what happens. For instance if the recovery time is equal to one day, logically no people die, which is not the case in your model. In your model there is no relation between the average treatment time and the average time for mortality.
I think that either you use the simple and clear frequency formulation supposing that the average treatment time is fixed or you consider that the average treatment time can be reduced and you must formulate the effect of this reduction on the average time for mortality and reformulate the model. It all depends on the scope of your study.
I personally would in this case start with an even simpler model, writing down all the reality checks equations that need the model to conform to and build a very simple model from them, study the model generated using synthesim and once understood, get a small step further, repeating the process as explained in the chapter 14 of the user guide and in the paper joined.
You will get a high quality model whose implications you will have completely understood, a very rare case in SD current practice.
Apart from that the model seems correct as long as it correctly represents the assumption made about the reality you want to represent:
At the beginning of the simulation, all workers are considered exposed.
Once a worker is cured, it takes one year to be susceptible to get sick again once exposed it takes an average time to get sick. The rest has to be settled depending on the purpose of the model.
You have already understood that it is neccessayr to have correct units dimensionned, Ctrl_t and Ctrl_u with no errors or warnings, which is already good, go a step further and use reality checks.
Best regards.
JJ
RC_justification.pdf
(792.76 KiB) Downloaded 247 times
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: need help..

Post by tomfid »

Actually I think the model is OK with the mortality and treatment time constants at 1 month, as long as the time step is reduced. A good rule of thumb is that the time constant should be at least as small as half the shortest time constant in the model - i.e. 1/2 month in this case.
Wilson
Administrator
Posts: 51
Joined: Thu Mar 06, 2003 5:05 am

Re: need help..

Post by Wilson »

To add a bit to Tom's rule of thumb.

When using a delay function, such as a 3rd order delay, I was told many years back to use the following rule to calculate the maximum size of the time step allowed:

Min(Delay Time) / 4n where n is the order of the delay

In the attached model, although you have not used any of the Vensim "Delay" functions, you have explicitly created a few first order delays (rate=stock level/average delay), where the delay is one month for "Average Treatment Time"

So applying the Time Step rule

DT <= 1/(4x1)

So Time Step should be 0.25 or smaller.

If results start to look odd in one of my models this is one of the first things I would always check.
Post Reply