Level initial series

Use this forum to post Vensim related questions.
Post Reply
thifei
Junior Member
Posts: 11
Joined: Mon Dec 11, 2023 4:05 pm
Vensim version: DSS

Level initial series

Post by thifei »

Hello everyone,

For a level variable, is it possible to set a time series as initial values?

My problem is the following:
I build a population model with a starting date in 1995. I have the observed data from 1995 up to now, and I want to set these data as the level behavior until the model starts its projections, so the initial value used for the projection correspond to current data (2023).

I tried things like : IF THEN ELSE (Time>2023 , INTEG(birth-death, GET DATA AT TIME(historical pop,2023)), historical pop) in an auxiliary but it didn't work.

Any ideas on how to do the trick?

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

Re: Level initial series

Post by Administrator »

You cannot set the initial population to be a time series, it's an initial value, so a constant.

But I think the following will do what you need.

population = INTEG(birth-death, initial population)

population used before projections start = if then else ( time < 2023, historical pop, population).

Now use "population used before projections start" when you are trying to generate any projections. It will have data until time = 2023, and the calculated value of population after that.
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
thifei
Junior Member
Posts: 11
Joined: Mon Dec 11, 2023 4:05 pm
Vensim version: DSS

Re: Level initial series

Post by thifei »

Thank you for the quick answer,

The problem is that population projections and empirical data don't fit perfectly. So if I do this method I think I will have a jump from empirical data to calculated data (from start date in 1995) at the time the model starts the projections as both will diverge in the first period. I would like to start my projections from 2023 empirical data (as there is a loop from population to birth and death).
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Level initial series

Post by tomfid »

It sounds like you want a population stock that's moving approximately alongside the data from 1995-2023, then reset the population stock to precisely match the data at 2023, then have the population evolve into the future by endogenous forces?

If so, there are several ways to do this. The general idea would be something like:

population = INTEG( births-deaths + correction, initial population)
initial population = pop data
correction = (pop data - population)*correction rate

For a one-time reset, the correction rate could be:

correction rate = PULSE(end of pop data,TIME STEP)/TIME STEP
end of pop data = GET DATA LAST TIME(pop data)

You could also make continuous corrections at some small rate, which would be kind of like Kalman filtering. Personally, I would prefer to use the optimizer to make the historical fit good enough to avoid the need for the correction.
thifei
Junior Member
Posts: 11
Joined: Mon Dec 11, 2023 4:05 pm
Vensim version: DSS

Re: Level initial series

Post by thifei »

Thnak you for your answer,

I finally found a solution. I keep a stock and set the initial value at 2023 with GET DATA AT TIME, and I count the flows if time>2023 with IF THEN ELSE or else 0.

I then do an aggregation variable with historical data before 2023, and calculated data after
Post Reply