Page 1 of 1

function to retain another variable at time T-1

Posted: Mon Oct 21, 2013 1:21 am
by thrillz84
Hi there,

Please is there any technique or function I can use to hold the value of a variable such that variable "A" at time T or T+1 will have the value of a variable "B" at that "T" or "T-1" respectively. Many thanks

Olu

Re: function to retain another variable at time T-1

Posted: Mon Oct 21, 2013 8:19 am
by Administrator
Take a look at SAMPLE IF TRUE or DELAY FIXED. One of these should do what you need.

Tony.

Re: function to retain another variable at time T-1

Posted: Mon Oct 21, 2013 2:51 pm
by thrillz84
perhaps mixed it up..I need a function that can perform the opposite of the delay function i.e a function that will let a variable "A" at time T to hve a value of a variable "B" t time T+1

Re: function to retain another variable at time T-1

Posted: Mon Oct 21, 2013 3:19 pm
by tomfid
Vensim (and reality) is causal - that is, no variable can use information about the future.

Can you say more about the reason for this approach?

Re: function to retain another variable at time T-1

Posted: Tue Oct 22, 2013 2:04 pm
by thrillz84
cheers Tom, in the attache model for example, I need a function that will let variable "y" have values of 0.94, 0.909651...at times t= 1 and 2 ....theoretically i know it isnt right but I need it or some analysis...tnx

Re: function to retain another variable at time T-1

Posted: Tue Oct 22, 2013 2:23 pm
by Administrator
There is no function that can do that. You can try using FORECAST or TREND. Otherwise, you would need to calculate the model a time step in the future.

Re: function to retain another variable at time T-1

Posted: Tue Oct 22, 2013 8:38 pm
by tomfid
There is a trick you could do though - cumbersome in general, but feasible in a simple model. Create an auxiliary that calculates the value of the stocks ahead a unit of time (assuming Euler integration):

future bad code = bad code + roc*TIME STEP

Then use can use the "future" stocks to calculate other future variables.

Re: function to retain another variable at time T-1

Posted: Wed Oct 23, 2013 11:08 pm
by thrillz84
cheers Tom!!!should have thought of that

Re: function to retain another variable at time T-1

Posted: Thu Oct 24, 2013 2:09 am
by tomfid
The other possibility is to just put minus signs in all your integrations, and run the whole model backwards. :mrgreen:

Re: function to retain another variable at time T-1

Posted: Thu Oct 24, 2013 11:25 pm
by thrillz84
:D splendid!!