Hi,
I would like to be able to make a lookup with two variables. On the basis of an oil price difference and a hedging time period, a premium should be calculated (with interpolation for other months between 3 and 9). Rather than using different (consecutive) lookups, is there a good way to implement this?
The attached table gives the basic information.
Thanks,
Two dimensional lookup
Two dimensional lookup
- Attachments
-
- doublelookup.xls
- (14.5 KiB) Downloaded 562 times
two dimensiional lookup
HI
One way to manage a two dimensional lookup, whatever the kind of dimension (it looks like Time in your case), I have the same case but with price elasticities of different type of products, varying eventually with time which would make it a three dimensional lookup.
One way is to simulate the lookup with common equations, eventually using soft if then else to ease optimization, or to adjust your lookup with a function using constants.
The advantage of both solutions, is that you can or calibrate the lookup or use optimization, using the constants of the simulated lookups or the constants of the adjusting function.
Or you can just, import the lookups at different time from a spreadsheet, as imported data, storing them or not in an subscripted array but no calibration or optimization as I think. But some people with more knowledge then me must certainly, I hope, know better.
J.J. Laublé
One way to manage a two dimensional lookup, whatever the kind of dimension (it looks like Time in your case), I have the same case but with price elasticities of different type of products, varying eventually with time which would make it a three dimensional lookup.
One way is to simulate the lookup with common equations, eventually using soft if then else to ease optimization, or to adjust your lookup with a function using constants.
The advantage of both solutions, is that you can or calibrate the lookup or use optimization, using the constants of the simulated lookups or the constants of the adjusting function.
Or you can just, import the lookups at different time from a spreadsheet, as imported data, storing them or not in an subscripted array but no calibration or optimization as I think. But some people with more knowledge then me must certainly, I hope, know better.
J.J. Laublé
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
It is often true that in multiple dimensions it is easier to formulate some sort of algebraic expression. - but 2d lookups can be done.
The attached model solves the problem by specifying a series of 1 dimensional lookups that are slices through the 2d surface and then interpolating between the solution points of adjacent slices. If you muck around with it I think you will see how it works. It may be easier to setup the numbers in Excel and use the GET XLS LOOKUPS function to bring them into Vensim.
The attached model solves the problem by specifying a series of 1 dimensional lookups that are slices through the 2d surface and then interpolating between the solution points of adjacent slices. If you muck around with it I think you will see how it works. It may be easier to setup the numbers in Excel and use the GET XLS LOOKUPS function to bring them into Vensim.
- Attachments
-
- 2dlookup.mdl
- (3.47 KiB) Downloaded 632 times