Endogenizing subscript values
Endogenizing subscript values
Dear all,
I am using subscripts for a model and I would like to make the values of the subscript elements endogenous. However, when I replace the numbers with the expression of an equation, I get the message "expecting an operator" and I can't figure tout how to solve this problem. Would you have any suggestion ?
Please find enclosed a small model I made to learn how to use subscript in Vensim. Subscript values are defined in the "future consumption" variable. I'd like to replace them by expressions to make them endogenous.
Many thanks for your help.
Louison
I am using subscripts for a model and I would like to make the values of the subscript elements endogenous. However, when I replace the numbers with the expression of an equation, I get the message "expecting an operator" and I can't figure tout how to solve this problem. Would you have any suggestion ?
Please find enclosed a small model I made to learn how to use subscript in Vensim. Subscript values are defined in the "future consumption" variable. I'd like to replace them by expressions to make them endogenous.
Many thanks for your help.
Louison
- Attachments
-
- toy_model_subscript_June_7.mdl
- (2.44 KiB) Downloaded 208 times
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Endogenizing subscript values
If I understand you correctly, you want the values for "FUTURE CONSUMPTION" to be in an external file? If yes, there is a whole section in the documentation on data (time series)
http://www.vensim.com/documentation/ind ... f_data.htm
If you have constants, you can still use the data way to get values into your model, or use CIN files.
http://www.vensim.com/documentation/ind ... _files.htm
http://www.vensim.com/documentation/ind ... hanges.htm
http://www.vensim.com/documentation/ind ... ?23320.htm
http://www.vensim.com/documentation/ind ... f_data.htm
If you have constants, you can still use the data way to get values into your model, or use CIN files.
http://www.vensim.com/documentation/ind ... _files.htm
http://www.vensim.com/documentation/ind ... hanges.htm
http://www.vensim.com/documentation/ind ... ?23320.htm
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Endogenizing subscript values
Thank you very much for your reply, I will dig into the documentation you pointed out to.
To be more precise: I don't want the values to be in an external file, I want them to be determined by an equation relating to other variables in the model (hence making them endogenous). In other terms I want the values of the subscript elements to be determined by the model itself and not to be numbers fixed ex ante. Is there a way to do that ? Simply writing an equation instead of the numbers doesn't work (error message "expecting an operator").
To be more precise: I don't want the values to be in an external file, I want them to be determined by an equation relating to other variables in the model (hence making them endogenous). In other terms I want the values of the subscript elements to be determined by the model itself and not to be numbers fixed ex ante. Is there a way to do that ? Simply writing an equation instead of the numbers doesn't work (error message "expecting an operator").
Re: Endogenizing subscript values
What does the subscript dimension represent? (If it's time, time is already implicit; you don't need a subscript.)
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Endogenizing subscript values
Can you upload the model that has the "expecting an operator" error?Louison wrote: ↑Mon Jun 11, 2018 1:02 pm Thank you very much for your reply, I will dig into the documentation you pointed out to.
To be more precise: I don't want the values to be in an external file, I want them to be determined by an equation relating to other variables in the model (hence making them endogenous). In other terms I want the values of the subscript elements to be determined by the model itself and not to be numbers fixed ex ante. Is there a way to do that ? Simply writing an equation instead of the numbers doesn't work (error message "expecting an operator").
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Endogenizing subscript values
Tom: it represents expected values of consumption at different point of time in the future. We need these expected values to change endogenously and then to feed in other variables and we are struggling finding a way to do it with Vensim. We thought subscripts could do.
Admin: it is the model I attached with my first post, with any expression instead of the numbers in the future consumption variable (I apologize I write from my personal computer and I do not have Vensim DSS on this one to replicate the error).
Admin: it is the model I attached with my first post, with any expression instead of the numbers in the future consumption variable (I apologize I write from my personal computer and I do not have Vensim DSS on this one to replicate the error).
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Endogenizing subscript values
It works fine for me, I really need to see what you are doing to help.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Endogenizing subscript values
I think you need VECTOR LOOKUP then.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Endogenizing subscript values
I apologize not to be able to upload an example that replicate the error at the moment, I won't be back on my office computer equipped with DSS for a week.
In the current example I uploaded in my first post, the values of the elements of the c_exp subscript are defined in the future consumption variable as numbers: 10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,50,50,50,50,50,50,50,50,50,48,46,44,42,40,39,36,34,32,30,28,26,24,22,20,18,16,14,12,10 (there are 50 elements for the subscript c_exp).
What we would like to do is to replace these numbers with expressions to make these values endogenous. So for instance instead of the numbers we would have, say, delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1) or any other equation (of course in our full model the endogenous values for the subscript elements will differ).
In the current example I uploaded in my first post, the values of the elements of the c_exp subscript are defined in the future consumption variable as numbers: 10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,50,50,50,50,50,50,50,50,50,48,46,44,42,40,39,36,34,32,30,28,26,24,22,20,18,16,14,12,10 (there are 50 elements for the subscript c_exp).
What we would like to do is to replace these numbers with expressions to make these values endogenous. So for instance instead of the numbers we would have, say, delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1),delay(consumption,1) or any other equation (of course in our full model the endogenous values for the subscript elements will differ).
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Endogenizing subscript values
You can only separate constants by a comma, not equations. But you can add equations (and have one for each subscript element if you really wish).
http://www.vensim.com/documentation/ind ... ?22065.htm
http://www.vensim.com/documentation/ind ... ?22065.htm
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Endogenizing subscript values
Is the mapping one to one, i.e. at each present point in time, is there one corresponding future expectation of consumption? In that case, you could use something much simpler, like
expected consumption = SMOOTH( consumption, horizon )
expected consumption = SMOOTH( consumption, horizon )
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: Endogenizing subscript values
Admin: I hadn't thought about multiple equations to do it but looking again at the user guide, it seems it could be indeed a way to go. So using multiple equation we could define each element of a same subscript by an equation ? That's how I understand the example in the user guide, am I correct ?
Tom: at each present point in time, we would need the whole set of expected consumptions to be computed.
Many thanks for your help and time, I will post here feedbacks as soon as we have tried your suggestions.
Tom: at each present point in time, we would need the whole set of expected consumptions to be computed.
Many thanks for your help and time, I will post here feedbacks as soon as we have tried your suggestions.
Re: Endogenizing subscript values
I would hope that the expectations are all structurally the same, so that you could have one subscripted equation, and supply a vector of parameters. as in:
expected C[e] = SMOOTH( consumption, horizon[e] )
horizon [e] = 1,2,3,4,...
expected C[e] = SMOOTH( consumption, horizon[e] )
horizon [e] = 1,2,3,4,...
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/