Hi,
I have a level called Providers that has two subscripts, province and age. Providers is the integral of two rates: global entries (going in), and exits (going out), both of which are also subscripted by province and age.
Also, using the 'shift if true' function, I have an aging chain set up to age everyone in the Providers level once a year. At least, I think I do. I have the 'shift is true'written as follows:
Provider Aging = shift if true(Providers[Province, a22], Time=integer(Time), ELMCOUNT(AGE), 0, Global Entry[Province, a22])
My understanding of the 'shift if true' function is that it shifts relative to the rightmost subscript of the variable of interest, so if I want to shift the ages of Providers, I should have it declared as Providers[province, age], and thus also have Entries[province, age] and Exits[province, age]. However, when I write them that way, I get the following error message:
"Subscript 1 of variable -Providers- is a member of the -age- family when it should be a member of the -province- family."
I get a similar error saying subscript 2 is -province- when it should be -age-, and I get the pair of errors again for Entries, Exits, and then again for Providers.
When I switch the order of the subscripts like so:
Providers[age, province]
Entries[age, province]
Exits[age, province]
Provider Aging=shift if true(Providers[a22, Province], Time=integer(Time), ELMCOUNT(AGE), 0, Global Entry[a22, Province])
(which, as I understand it, should not work as I'd be trying to 'age' based on the rightmost subscript, province), the model runs without errors (except to warn me that 'Provider Aging' is not used in the model), which confuses me.
What am I missing?
Thanks.
subscripting in "shift if true"
-
- Junior Member
- Posts: 8
- Joined: Tue Nov 30, 2004 1:58 pm
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
It sounds like you have defined "Providers[age,province]" rather than Providers[Province,age] - go to the Providers equation and change the order of subscripts. You will need to do the same everywhere it is used.
Also Global Entry should not be used in the Shift If True equation but directly in the equation for Providers. Actually the equation you have should fail units checking. Be sure to check units!
Also Global Entry should not be used in the Shift If True equation but directly in the equation for Providers. Actually the equation you have should fail units checking. Be sure to check units!
-
- Junior Member
- Posts: 8
- Joined: Tue Nov 30, 2004 1:58 pm
Thanks for your response, Bob.
I agree with your first assessment However, when I tried what you've suggested before (i.e. defining providers as Providers[province, age]), I got an error telling me subscript 1 is age when it should be province and vice versa, when in fact the opposite is true (unless Vensim counts subscripts from right to left). I get similar errors for entries and exits when they are defined this way.
Just so I'm clear, when I have Providers defined as follows:
Providers[Province, AGE]= INTEG (
Global Entry[Province, AGE]- Exits[Province, AGE], Initial Provider Stock[Province, AGE])
~ provider
~ Number of available providers
and Global Entry and Exits both defined accordingly (i.e. with subscripts [province, age]), I get an error telling me that "Subscript 1 of variable -Providers- is a member of the -age- family when it should be a member of the -province- family.", even though it looks to me like this is not the case. I get the same error for global entry and exits, and then a repeat of the error for providers.
Thanks for your second comment; apparently I'm in need of some clarification on how shift if true works.
Somehow I would like to 'age' my stock of providers. That is, once a year I would like to shift them all up one age group, with value for the leftmost (i.e. youngest) category replaced by the number of new entrants in that age group. As far as my model is concerned, providers are 'born' at age 22 and 'die' after age 65.
By my understanding of how shift if true works, the way I defined 'aging',
Provider Aging[Province]=shift if true(Providers[Province, a22], Time=integer(Time), ELMCOUNT(AGE), 0, Global Entry[Province, a22])
should accomplish this. That is, it should shift ELMCOUNT(AGE)=44 elements of Providers whenever time is an integer, with the age64 value replacing the age65 value, and the age22 value being replaced with the number of new entrants of age 22.
Could you please explain where I am mistaken?
Thanks again for the help.
I agree with your first assessment However, when I tried what you've suggested before (i.e. defining providers as Providers[province, age]), I got an error telling me subscript 1 is age when it should be province and vice versa, when in fact the opposite is true (unless Vensim counts subscripts from right to left). I get similar errors for entries and exits when they are defined this way.
Just so I'm clear, when I have Providers defined as follows:
Providers[Province, AGE]= INTEG (
Global Entry[Province, AGE]- Exits[Province, AGE], Initial Provider Stock[Province, AGE])
~ provider
~ Number of available providers
and Global Entry and Exits both defined accordingly (i.e. with subscripts [province, age]), I get an error telling me that "Subscript 1 of variable -Providers- is a member of the -age- family when it should be a member of the -province- family.", even though it looks to me like this is not the case. I get the same error for global entry and exits, and then a repeat of the error for providers.
Thanks for your second comment; apparently I'm in need of some clarification on how shift if true works.
Somehow I would like to 'age' my stock of providers. That is, once a year I would like to shift them all up one age group, with value for the leftmost (i.e. youngest) category replaced by the number of new entrants in that age group. As far as my model is concerned, providers are 'born' at age 22 and 'die' after age 65.
By my understanding of how shift if true works, the way I defined 'aging',
Provider Aging[Province]=shift if true(Providers[Province, a22], Time=integer(Time), ELMCOUNT(AGE), 0, Global Entry[Province, a22])
should accomplish this. That is, it should shift ELMCOUNT(AGE)=44 elements of Providers whenever time is an integer, with the age64 value replacing the age65 value, and the age22 value being replaced with the number of new entrants of age 22.
Could you please explain where I am mistaken?
Thanks again for the help.
substripts and shift if true
Why not join a very simplistic model summarizing the problem.
It will have three benefits.
After having simplified the problem, you may find the solution by yourself.
It will ease the understanding of the problem.
It will increase the people susceptible to study your problem, easier to understand and to make concretely work.
Regards.
J.J. Laublé
It will have three benefits.
After having simplified the problem, you may find the solution by yourself.
It will ease the understanding of the problem.
It will increase the people susceptible to study your problem, easier to understand and to make concretely work.
Regards.
J.J. Laublé
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Your equation for Providers is correct. Your equation for Provide Aging should be
Provider Aging[Province]=shift if true(Providers[Province, a22], Time=integer(Time), ELMCOUNT(AGE), 1,0)
(or 0,0) if you want to force retirement
The inflow is already in the Providers equation. As to the error messages - they do not make sense to me - I suspect you have other uses of Providers you have not changed. As JJ says, you should just take out the equations for this piece - setting initial... to 0 and see if it works. If it doesn't post it and it will be easy to figure out what is happening.
Provider Aging[Province]=shift if true(Providers[Province, a22], Time=integer(Time), ELMCOUNT(AGE), 1,0)
(or 0,0) if you want to force retirement
The inflow is already in the Providers equation. As to the error messages - they do not make sense to me - I suspect you have other uses of Providers you have not changed. As JJ says, you should just take out the equations for this piece - setting initial... to 0 and see if it works. If it doesn't post it and it will be easy to figure out what is happening.