cohort modeling examples

A place for Ventity software questions & answers
tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

cohort modeling examples

Postby tomfid » Thu Sep 24, 2015 8:39 pm

CohortPopVentityModels.zip
(35.58 KiB) Downloaded 123 times


This archive contains some examples of cohort models. I explain how they work in a video https://vimeo.com/140356008.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Fri Sep 25, 2015 1:03 pm

Hi Tom

This is great! The models and your explanation helped me a lot to get the concept. Just as a test for myself I added in CohortPop1 and CohortPop2 the issue of the onset of a chronic disease (say diabetes, starting at a certain age). This is straightforward indeed (see attachment). In CohortPop2b I addressed the issue of diagnosing a certain disease (say coronary heart disease) with a certain fraction of positive and negative diagnoses (no false diagnoses assumed). All deaths rates have been remained the same as to test the total sum.

Justus
Attachments
CohortPop_Justus.zip
(40.17 KiB) Downloaded 85 times

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Fri Sep 25, 2015 2:31 pm

This is cool. I think it's also the very first working Ventity model submitted by an external user - a bit of a milestone for us. Thanks!

It would be cool to have an infectious disease variant of this, where each cohort is essentially an SIR model, with infection crossover among the cohorts. I'll have to cook one up.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Mon Sep 28, 2015 3:13 pm

A good example might be AIDS, where infections start with a certain age, and decline after a certain age (sexual behavior). This could be described by a contact rate depending on age. What do you think about that? Yet, the population of the first "infected" is not clear to me.

Regards

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Wed Sep 30, 2015 10:17 am

A simple question: I wanted to create a subcollection of population in the CohortPop2 model for the sexual active population. I tried to create an attribute (sexual active), depending on Age (15< Age < 70). But this obviously didn't work and I was also not able to use this information to build the sum over this sexual active population. How should I proceed?

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Mon Oct 05, 2015 4:47 pm

Selection by value is an unimplemented feature. There are a couple of possible workarounds - I'll test to see which works best.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Mon Oct 05, 2015 10:33 pm

CohortPop5+ageMonitorAlt.zip
(13.48 KiB) Downloaded 73 times
Here's an example.

I've added an attribute, "is childbearing age," that contains "yes" or "no". Then I created a collection, cohort[parent population, is childbearing age] that calculates some aggregates, like the population of child bearing age. The trick is that a normal attribute expression initializes it, but doesn't update it. For the updates, I created a trigger/action pair, "update childbearing." If you inspect the action, you'll see that it sets the attribute to yes or no according to the birth rate observed for the cohort. You could also look at age, but that's problematic if the user changes the birth rate lookup, so I think looking at de facto childbearing is safer.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples - leakage

Postby moudi » Tue Nov 24, 2015 2:03 pm

Hi
I'm still working on the cohort modeling issue. I would be interested to have a stock with two outflows. One is related to deaths (mortality rate as a function of age), and the other as a function of the duration in that stock (incidence rate of cardiac symptoms). The first flow rate is straightforward. For the second I used as a first try a simple fractional outflow. However, one could think of a situation where this incidence starts only after a certain time. What could be a solution? Create a chain of stocks? Or is there an analogy to the leakage formulation in Vensim? Other solutions? The model included is still a conceptual model using hypothetical numbers.

Thanks

Justus
Attachments
CohortPop2 with CHD with readmission.zip
(14.84 KiB) Downloaded 56 times

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Wed Nov 25, 2015 4:21 pm

We haven't implemented discrete delays and the like yet, mainly because there hasn't been a request.

My experience with conveyors with leakage and similar builtin functions is that I can never use them, because there's always some minor violation of the assumptions of the structure.

So, I can think of several options:
- chain of stocks, as you suggest
- we implement a discrete delay (useful for simple situations, without leakage)
- break the cohort into some sub-cohorts, so that you can have multiple instances, time stamped by the group's time in the "delayed incidence" state

I'll take a look at the model.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Thu Nov 26, 2015 7:25 am

Hi

Thanks for your reply. I can pretty well understand your point! I assume that the third option you mention is closest to my expectations. The incidence of cardiac symptoms should increase as a function of time elapsed since the last therapeutic intervention. Do you have already a sample model demonstrating this "time stamp" issue?

Best regards

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Tue Mar 29, 2016 8:55 am

Hi

I wanted to modify the model "CohortPop2" as to include gender (male, female), without changing the model structure otherwise.

However, I didn't manage. Is it correct to define another entity called "gender" and to use it later as an attribute for the cohorts (or for population)? However, the action for creating cohorts should now take place both for male and female. I don't understand how to formulate this. I'm struggling still with basic problems, I'm afraid.

Thanks for further explanations.

Best

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Wed Mar 30, 2016 6:20 am

Hi

I tried to introduce a new entity (gender) with properties (male, female). The model is running (somehow), but I didn't manage to sum male+female. It seems that I do something wrong with the references. The model is uploaded.

Best
Attachments
CohortPop2_gender.zip
(9.4 KiB) Downloaded 46 times

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Wed Mar 30, 2016 2:52 pm

I'll take a look ...
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Thu Mar 31, 2016 5:25 pm

OK ... here's a solution. There's a glitch: it may not run until you get the next beta (which I'm uploading right now).

When I built the original prototype for this, I shouldn't have put the top level in the Model entity, because that's a "singleton," i.e. there can be only one Model in a model. So I moved the infrastructure into a "group" entity, where a group might have attributes like gender and country, and owns a set of cohorts.

I left the age mortality rate lookup and the cohort interval in the Model, as globals, but if mortality differs by gender, I'd probably want to move that.

CohortPopGroups3 fixup (2).zip
(10.72 KiB) Downloaded 55 times
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Mon Apr 04, 2016 7:18 pm

BTW the new build needed for this to work is now available (see top announcement).
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Fri Apr 08, 2016 12:58 pm

Thanks, that helps!

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Thu Jun 02, 2016 7:28 am

Hi

coming back to the issue of having different lookups for mortality rates for e.g. gender, region at the group level. I tried to move the lookup to the group level and got the following error message:
Reference "Cohort" Missing condition for "CohortID" attribute.

I have two questions:
a) how to fix this problem?
b) once the problem is fixed, how can I initialize the different lookups?

Thanks and best regards
Attachments
CohortPopGroups3 fixup mortality group.zip
(11.62 KiB) Downloaded 40 times

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Thu Jun 02, 2016 1:47 pm

I haven't had a chance to look at the model, but here's what that message probably means:

(a) Somewhere (probably your new "group" entitytype) you have a Reference that points to Cohort entities. If you open the inspector for the new entitytype, and switch to the references tab, you'll find it there. Edit that reference, and you'll find that its "value to match" field is empty. That's my guess anyway - I'll take a look later.

(b) It should be possible to put them in the entity initialization data, but there seems to be a bug with reading it. We're working on it.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Mon Aug 29, 2016 9:20 am

Hi

First, let me thank you for the wonderful videos with the SIR-model!
Today let me ask a question about a cohort model you posted previously (e.g. CohortPop4). Here the results depend strongly on the choice of the cohort creation interval (in case of endogenous births). Three questions:
a) What is the reason for this?
b) Is there a "right" choice?
c) how could the difference be eliminated? By choosing different input data specifically for a shorter interval?

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Mon Aug 29, 2016 3:17 pm

I think the answer probably has to do with the granularity of the input data, but I'll have to fire it up and take a look to be sure.
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

tomfid
Administrator
Posts: 1954
Joined: Wed May 24, 2006 4:54 am
Location: Montana, USA
Contact:

Re: cohort modeling examples

Postby tomfid » Mon Aug 29, 2016 8:06 pm

This turns out to be quite tricky.

I ran the model with 5 and 10 year cohorts, and got quite different results. The difference emerges with births from the earliest created cohorts (not the preexisting ones in the data). Here's the sum of births:
births.png
births.png (13.09 KiB) Viewed 1743 times


The difference arises from the timing of the onset of births. If you pair up the 5 year cohorts and sum them to match the 10 year cohorts, they don't quite align:
births.png
births.png (13.09 KiB) Viewed 1743 times


There are two reasons for this:
1. I calculated cohort age as (Model.Time-Creation Time) which is a bit sloppy - this is really the age of the edge of the cohort interval, not the middle. Hence the lag between series.
2. The birth rate reads from a single point on the age-birth lookup, rather than the average over the cohort's interval. This is really an abuse of the table. Either the lookup should read an average over a range of times, or the table data should be smoother for longer intervals.
Attachments
cohort_1_2_births.png
cohort_1_2_births.png (15.35 KiB) Viewed 1743 times
/*
Advice to posters (it really helps us to help you)
viewtopic.php?f=2&t=4391

Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics

*/

moudi
Senior Member
Posts: 59
Joined: Thu Nov 18, 2010 9:18 am

Re: cohort modeling examples

Postby moudi » Tue Aug 30, 2016 7:42 am

Thanks

I tried now the model with constant exogenous births and intervals of 10 and 1 year, assuming that no differences in Sum Population should occur. However, they still prevail, presumably due to the same table issue with regard to mortality.
Cohort Pop 4 deaths.JPG
Cohort Pop 4 deaths.JPG (48.46 KiB) Viewed 1738 times


Return to “Ventity”

Who is online

Users browsing this forum: No registered users and 1 guest