Delay with dispersion AND leakage

Use this forum to post Vensim related questions.
Post Reply
kleemax
Senior Member
Posts: 125
Joined: Tue Jan 26, 2016 3:50 pm
Vensim version: PRO

Delay with dispersion AND leakage

Post by kleemax »

Conveyor is a delay function with leakage
Delay N is a delay function with dispersion/variance, i.e. a pulse input of one DT gives a curved output, which is more dispersed than the input.

As far as I know, there is no built-in delay function that allows for both.
Is there a smart way of combining the two to get a function that combines both properties?

I know I could build a function like this using subscripts, but comes with its own disadvantages...
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Delay with dispersion AND leakage

Post by tomfid »

I did something like this recently by splicing together a pipeline delay and a delay3 in a macro. It worked surprisingly well. I'm not on the same machine at the moment, but happy to share if useful.
kleemax
Senior Member
Posts: 125
Joined: Tue Jan 26, 2016 3:50 pm
Vensim version: PRO

Re: Delay with dispersion AND leakage

Post by kleemax »

Would be great if you could share that Tom. I hadn't thought of a macro yet, yours may inspire me.
kleemax
Senior Member
Posts: 125
Joined: Tue Jan 26, 2016 3:50 pm
Vensim version: PRO

Re: Delay with dispersion AND leakage

Post by kleemax »

Is there another place where to enter feature requests? DelayNL would be a feature request for a built-in function of a higher-order delay with leakage. It could e.g. differ from a normal DelayN in the way taht a conveyor differs from DelayFixed.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Delay with dispersion AND leakage

Post by tomfid »

I'll dig it up.

What do you need N to be? If it's 3 or 5 or something, it's fairly easy to write a macro (though the initial conditions are rather complicated). If it's 40, that gets messy.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: Delay with dispersion AND leakage

Post by tomfid »

I've attached the explicit version of the model. I thought it would be good to clean things up a bit before redoing the macro for public consumption.

I built this for an SEIR model for Chronic Wasting Disease (CWD) in deer. In the literature, a lot of models use rather high-order delays (e.g. 44) for the various phases. As a side note, I think this may be technically correct, but wasted horsepower, because the dispersion of delay durations across models has more variation than the duration of the delay within any given model.

Anyway, it's easy enough to replicate arbitrary delay structures with arrays, but rather inconvenient to have 44th order for the E phase, 38th for the I phase, etc. So I wanted something with roughly the right arrival distribution, but a simpler structure. As an experiment, I created a hybrid delay with two phases: a pipeline delay (DELAY FIXED) followed by a DELAY3.

The complication in all this is that there is leakage in the delay structure. Deer progression through CWD has a high order structure, but deer are also subject to ordinary mortality (getting shot, hit by a car, etc.) that is basically first order. Computing this leakage is complicated for arbitrary delays, but it turns out that it can be solved analytically for DELAY FIXED and computed explicitly for DELAY3.

The result is the attached structure:
leaky delay explicit 1.mdl
(14.35 KiB) Downloaded 98 times
There's one key limitation: the delay duration is fixed. There's also one point to ponder: the delay duration is specified for the no-leak case. Leakage shortens the effective delay duration, because it affects the age distribution across the delay structure. In my case, this is OK, because the CWD progression timing is known from experimental situations where there is no hunting or other mortality, i.e. no leakage. In other cases, you'd have to correct for this (I think it can be done analytically without much difficulty, but I haven't tried).
Post Reply