Seeking feedback on SIR Model Prototype

Use this forum to post Vensim related questions.
Post Reply
msilver
Junior Member
Posts: 19
Joined: Sun Mar 13, 2022 2:38 am
Vensim version: PLE

Seeking feedback on SIR Model Prototype

Post by msilver »

Hi all,

My name is Maxx, I'm a second-year post-grad studying Complex Systems at the University of Sydney. I'm using VensimPLE to model the game-theoretic relationship between uptake of PrEP and HIV/STI prevalence in the Australian state of New South Wales.

Last semester I successfully developed a model prototype that broadly reflects the systems I'm attempting to model. My goal this semester is to refine and improve the model. I'll be working on this project for the next 2-3 months and am hoping to engage this community as I iterate. An example of the sort of question that I'm hoping to answer is "what happens to the prevalence of HIV and STIs if PrEP uptake increases by X%?"

You might notice that I've leaned heavily on @Tom's Covid-19 modelling when developing the prototype (thanks, Tom!) Does anybody know of any existing HIV/STI models that I can reference? I haven't been able to find any.

Further to the above, I'm seeking general feedback and advice on my model implementation. There are some known unit errors that I have been unable to resolve, and some challenges implementing STEP functions and DELAY functions, amongst others. I've also noticed that the timescale of the simulation seems to be buggy, though I can't quite determine why. I'm also not confident in some of the equations and variable relationships that I've modelled (e.g., the STI stock and flow in View 2), and some of the graphical outputs are producing counter-intuitive results. Lastly, I would welcome any suggestions on Vensim form and function best practices.

Attached is most recent model file. I've tried to share a copy of my report from last semester as well, but am getting a file size error (3.5mb). The report contains an analysis of the model in its current state, as well as an SDM-Doc output. I'm happy to share this if it's helpful.

Thanks in advance for taking the time to review and respond.

Cheers,
Maxx
Attachments
PrEP Model_v9.2.1 copy.mdl
(14.59 KiB) Downloaded 104 times
Administrator
Super Administrator
Posts: 4589
Joined: Wed Mar 05, 2003 3:10 am

Re: Seeking feedback on SIR Model Prototype

Post by Administrator »

Fix the unit errors first as they usually show up real problems with the model. For example, you've got

Infected Encounters = "Avg. Number of Sexual Partners" * "Diagnosed (HIV)" * "Undiagnosed (HIV)"

I'm guessing this should this actually be
Infected Encounters = "Avg. Number of Sexual Partners" * ( "Diagnosed (HIV)" + "Undiagnosed (HIV)" )

This is indicated by the unit error and could potentially completely change all results from the model.

"Avg. Number of Sexual Partners", should that be measured in people/person/day?
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
msilver
Junior Member
Posts: 19
Joined: Sun Mar 13, 2022 2:38 am
Vensim version: PLE

Re: Seeking feedback on SIR Model Prototype

Post by msilver »

Thank you for the response. Yes, I think a summation of the infected (diagnosed + undiagnosed) is appropriate. I also think I need to incorporate the undiagnosed into that equation.

I believe you are also correct about the Avg # of Sexual Partners. I've updated as suggested - noting that the equivalent STI variable was already measured in people/person/day.

My plan from here is to begin testing the boundary cases. This should reveal additional logical and implementation errors. From there, I intend to iterate on the model and simplify/add complexity where appropriate. I'll update here as I have further questions. In the meantime, additional feedback is always welcome.

Thanks
msilver
Junior Member
Posts: 19
Joined: Sun Mar 13, 2022 2:38 am
Vensim version: PLE

Re: Seeking feedback on SIR Model Prototype

Post by msilver »

Hi all - a quick question about units and the Delay Fixed function:

I understand that the output units for the Delay Fixed function must match the input and initial. I also understand that for the flow variable in the SIR model, the units should be "People/Day". However, implementing a Delay Fixed variable in the flow function throws a unit error because the input is "People" and the output is "People/Day".

What is the best practice for implementing a Delay Fixed function as a flow variable? Should I create a separate aux variable to hold the Delay Fixed variable, then use that as an input into the flow variable?

Thanks in advance,
Maxx
Attachments
Unit check.png
Unit check.png (78.87 KiB) Viewed 1654 times
Flow function.png
Flow function.png (87.19 KiB) Viewed 1654 times
Model clip.png
Model clip.png (52.51 KiB) Viewed 1654 times
Administrator
Super Administrator
Posts: 4589
Joined: Wed Mar 05, 2003 3:10 am

Re: Seeking feedback on SIR Model Prototype

Post by Administrator »

You need to delay the flow into "Exposed (STI)", not the current number of people that are exposed.
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
msilver
Junior Member
Posts: 19
Joined: Sun Mar 13, 2022 2:38 am
Vensim version: PLE

Re: Seeking feedback on SIR Model Prototype

Post by msilver »

Thank you for the response. Can you please help me understand your comment? The scenario that I'm trying to achieve:

- Person A is exposed to an STI
- There is a delay of between 7-21 days
- Person A is now infectious

So my intuition is that I want to implement a delay after they are exposed, but before they are infected. Why would it be otherwise?

Thanks!
Administrator
Super Administrator
Posts: 4589
Joined: Wed Mar 05, 2003 3:10 am

Re: Seeking feedback on SIR Model Prototype

Post by Administrator »

>> Person A is exposed to an STI
This will be the rate at which people are exposed. Once they are exposed, they are added to the "exposed" level (as you have in your screen shot). Once the delay has elapsed, they will move from exposed to either infected or back to the susceptible population.

>> There is a delay of between 7-21 days
You probably do not want to use DELAY FIXED then. Have a look at the various delays available in the help system,
http://vensim.com/documentation/mgu09_c ... l?q=delays

Even if you do want to use DELAY FIXED, you delay the rate at which people are exposed, not the current number of people that are exposed.

Hope this helps.
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
msilver
Junior Member
Posts: 19
Joined: Sun Mar 13, 2022 2:38 am
Vensim version: PLE

Re: Seeking feedback on SIR Model Prototype

Post by msilver »

Thanks - this was helpful. I'm still not fully across the distinction between discreet and continuous delays, but I think that may be for another day. I take your point that Delay Fixed is probably not the correct choice here. From what I can tell, I should consider implementing Delay1 or Delay1I.

I'm refactoring the model a bit and will hopefully be back to this in a week or so. Thanks again for the advice.

-Maxx
msilver
Junior Member
Posts: 19
Joined: Sun Mar 13, 2022 2:38 am
Vensim version: PLE

Re: Seeking feedback on SIR Model Prototype

Post by msilver »

Thanks Tom! Honestly I had forgot about your blog as a resource .. I found it last semester but hadn't come back to it .. I'll check it out!

On another note, is there any reason that I shouldn't implement a closed-loop as shown below? Conceptually, the idea of the flow "stopping" when people recover doesn't make sense to me .. they just go back to being susceptible, right? I've done a couple of test runs and haven't obeserved any unexpected behaviour, but thought I'd ask for a "second set of eyes" here.

Thanks!
Maxx
Attachments
Screen Shot 2022-04-23 at 11.29.51 am.png
Screen Shot 2022-04-23 at 11.29.51 am.png (54.32 KiB) Viewed 1481 times
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: Seeking feedback on SIR Model Prototype

Post by tomfid »

This is a completely reasonable thing to do.

I think it's unusual for people to be immediately susceptible after recovering from infection, so you might consider one more stock (Recovered or Resistant) between the I and the S. This may not apply for STIs though.
Post Reply