aggregating values over time steps

Use this forum to post Vensim related questions.
Post Reply
magic_hat
Junior Member
Posts: 2
Joined: Fri Jun 07, 2019 5:12 pm
Vensim version: PLE

aggregating values over time steps

Post by magic_hat »

Hi, everyone. I am building an aging chain model to understand how interventions targeting diabetes incidence affect treatment cost.

In the model, a proportion of the susceptible population transitions to the first year of diabetes (DM1) , and then to the second and third year. Cost estimates for each year are applied to come up with a total cost of treating the population in each of the three years of disease progression.

The model documentation is appended below. I have two questions:

- I cannot seem to configure the model so that the total cost variable captures the aggregate cost of the model over time (i.e., the sum of Cost1, Cost2 and Cost3 across all time steps). Cost1-Cost3 are configured as auxiliary variables with arrows, rather than rates, linking DM1-DM3 to them. Cost1-Cost3 each have arrows linking to total cost, which is also an auxiliary.

- I'm getting unit errors for Cost1-Cost3. Units are specified as $/year, and the variables are a constant multiplied by the relevant DM stock (DM1-DM3), which is in persons/year. I'm not sure how to resolve this.

Thanks for any help you can offer!




(01) Cost1=
DM1*4100
Units: $/year

(02) Cost2=
DM2*4875
Units: $/year

(03) Cost3=
DM3*5650
Units: $/year

(04) DM1= INTEG (
toDM1-toDM2,
0)
Units: Persons/year

(05) DM2= INTEG (
toDM2-toDM3,
0)
Units: Persons/year

(06) DM3= INTEG (
toDM3,
0)
Units: Persons/year

(07) FINAL TIME = 10
Units: year
The final time for the simulation.

(08) INITIAL TIME = 0
Units: year
The initial time for the simulation.

(09) IR=
0.01
Units: Persons/year

(10) SAVEPER =
TIME STEP
Units: year [0,?]
The frequency with which output is stored.

(11) Susceptible= INTEG (
-toDM1,
1000)
Units: Persons

(12) TIME STEP = 1
Units: year [0,?]
The time step for the simulation.

(13) toDM1=
Susceptible*IR
Units: Persons/year

(14) toDM2=
DM1
Units: Persons/year

(15) toDM3=
DM2
Units: Persons/year

(16) totalCost=
Cost1+Cost2+Cost3
Units: $
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: aggregating values over time steps

Post by Administrator »

magic_hat wrote: Fri Jun 07, 2019 5:48 pm- I cannot seem to configure the model so that the total cost variable captures the aggregate cost of the model over time (i.e., the sum of Cost1, Cost2 and Cost3 across all time steps). Cost1-Cost3 are configured as auxiliary variables with arrows, rather than rates, linking DM1-DM3 to them. Cost1-Cost3 each have arrows linking to total cost, which is also an auxiliary.
Use a level to sum over time.
I'm getting unit errors for Cost1-Cost3. Units are specified as $/year, and the variables are a constant multiplied by the relevant DM stock (DM1-DM3), which is in persons/year. I'm not sure how to resolve this.
I think you'll find that the DM1-3 stocks should be measured in person (not person/year).
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
magic_hat
Junior Member
Posts: 2
Joined: Fri Jun 07, 2019 5:12 pm
Vensim version: PLE

Re: aggregating values over time steps

Post by magic_hat »

Hi, thanks for the reply. Changing "Total cost" from auxiliary to level solves the totals problem, but it creates another -- the totals are now lagged by one year. Any suggestions?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: aggregating values over time steps

Post by tomfid »

Financial totals are lagged by a year in reality as well. In other words, 2019 results aren't available at 2019.0; they're only available at then end of the year.

However, for display purposes, you can create an alternate time axis (using TIME BASE) that's shifted by a year, and use that for reporting the financials in tables.
Post Reply