cascadeProjectionValues
with cascadeType = "step"
¶
Note
In the examples below, whenever a valuation date is mentioned, we only use the month name, for brevity. Instead
of February
, you would write something like DATE(2021,2,28)
or EOMONTH(DATE(2021,2,1),0)
.
Equivalence with mapProjectionValues
¶
At each time step, a value is read from a different projection node. It can be written as an equivalent
piecewise-defined function containing different calls to mapProjectionValues
:
cascadeProjectionValues(varName, valnType, hLevel, January, March, 1, 0, 0, "step", "sum")
│ │ │ └──┬────────────────┘ │ │
@t=1, lookup January from: mapProjectionValues(varName, valnType, hLevel, January, 0, "sum")
@t=2, lookup February from: mapProjectionValues(varName, valnType, hLevel, February, 0, "sum")
@t≥3, lookup March from: mapProjectionValues(varName, valnType, hLevel, March, 0, "sum")
When using valnDateMonthsShift
, the precedent at each time step changes:
cascadeProjectionValues(varName, valnType, hLevel, January, March, 1, -1, 0, "step", "sum")
│ │ │ └──┬─────────────────┘ │ │
@t=1, lookup January from: N/A │ │ │ │ │ │
@t=2, lookup February from: mapProjectionValues(varName, valnType, hLevel, January, 0, "sum")
@t≥3, lookup March from: mapProjectionValues(varName, valnType, hLevel, February, 0, "sum")
@t=1
would lookup January from a precedent with a December
valuation date, but that's not part of the January
– March
series.
When using timeShift
, the lookup at each time step changes:
cascadeProjectionValues(varName, valnType, hLevel, January, March, 1, 0, 1, "step", "sum")
│ │ │ └──┬────────────────┘ │ │
@t=1, lookup February from: mapProjectionValues(varName, valnType, hLevel, January, 1, "sum")
@t=2, lookup March from: mapProjectionValues(varName, valnType, hLevel, February, 1, "sum")
@t≥3, lookup April from: mapProjectionValues(varName, valnType, hLevel, March, 1, "sum")
Examples¶
The examples below are all demonstrated in this example workbook.
Say you have a model with a single hierarchy node. There are some projection nodes using valuation type valnTypeData
that contains some data in variable VarA
. The starting projection node uses valuation type valnTypeCpv
and valuation
date January
.
Simple example¶
The variable named VarASimple
has the following formula:
cascadeProjectionValues("VarA","valnTypeData",1,February,April,1,0,0,"step","sum")
The precedents will be:
# | Valuation type | Valuation date |
---|---|---|
1 | valnTypeData |
February |
2 | valnTypeData |
March |
3 | valnTypeData |
April |
Say the precedents contain the following results:
Precedent 1
t | Date | varA |
---|---|---|
1 | February | \(x_1\) |
2 | March | \(x_2\) |
3 | April | \(x_3\) |
4 | May | \(x_4\) |
Precedent 2
t | Date | varA |
---|---|---|
1 | March | \(y_1\) |
2 | April | \(y_2\) |
3 | May | \(y_3\) |
4 | June | \(y_4\) |
Precedent 3
t | Date | varA |
---|---|---|
1 | April | \(z_1\) |
2 | May | \(z_2\) |
3 | June | \(z_3\) |
4 | July | \(z_4\) |
The results for this variable will be:
t | Date | VarASimple | Explanation |
---|---|---|---|
1 | January | N/A |
Look up from precedent with January valuation date, which is not in the series. |
2 | February | \(x_1\) | Look up February in precedent with February valuation date, which is t=1 from precedent #1 . |
3 | March | \(y_1\) | Look up March in precedent with March valuation date, which is t=1 from precedent #2 . |
4 | April | \(z_1\) | Look up April in precedent with April valuation date, which is t=1 from precedent #3 . |
5 | May | \(z_2\) | Look up May in precedent with April valuation date, which is t=2 from precedent #3 . |
6 | June | \(z_3\) | Look up June in precedent with April valuation date, which is t=3 from precedent #3 . |
With valnDateMonthsShift
¶
Variable VarAValnDateShift
has the following formula:
cascadeProjectionValues("VarA","valnTypeData",1,February,April,1,-1,0,"step","sum")
This is the same as the simple example, but with valnDateMonthsShift=-1
. The precedents are the
same, but at each time step, a precedent will be used that has a valuation date corresponding to the previous month
instead of the current month.
The results for this variable will be:
t | Date | VarAValnDateShift | Explanation |
---|---|---|---|
1 | January | N/A |
Look up from precedent with December valuation date, which is not in the series. |
2 | February | N/A |
Look up from precedent with January valuation date, which is not in the series. |
3 | March | \(x_2\) | Look up March in precedent with February valuation date, which is t=2 from precedent #1 . |
4 | April | \(y_2\) | Look up April in precedent with March valuation date, which is t=2 from precedent #2 . |
5 | May | \(z_2\) | Look up May in precedent with April valuation date, which is t=2 from precedent #3 . |
6 | June | \(z_3\) | Look up June in precedent with April valuation date, which is t=3 from precedent #3 . |
With timeShift
¶
Variable VarATimeShift
has the following formula:
cascadeProjectionValues("VarA","valnTypeData",1,February,April,1,0,1,"step","sum")
This is the same as the simple example, but with timeShift=1
. The precedents are the same, and the
same precedent is used at each time step as in the simple example. However, at each time step, the
date of a different time step is looked up from the precedent.
The results for this variable will be:
t | Date | VarATimeShift | Explanation |
---|---|---|---|
1 | January | N/A |
Look from precedent with January valuation date, which is not in the series. |
2 | February | \(x_2\) | Look up March in precedent with February valuation date, which is t=2 from precedent #1 . |
3 | March | \(y_2\) | Look up April in precedent with March valuation date, which is t=2 from precedent #2 . |
4 | April | \(z_2\) | Look up May in precedent with April valuation date, which is t=2 from precedent #3 . |
5 | May | \(z_3\) | Look up June in precedent with April valuation date, which is t=3 from precedent #3 . |
6 | June | \(z_4\) | Look up July in precedent with April valuation date, which is t=4 from precedent #3 . |
With valnDateMonthsShift
and timeShift
¶
Variable VarAValnDateShiftTimeShift
has the following formula:
cascadeProjectionValues("VarA","valnTypeData",1,February,April,1,-1,1,"step","sum")
This combines the valuation date shift example and the time shift example. Please ensure that you understand both before reading this example.
The precedents are the same as in the simple example. Akin to the valuation date shift example, at each time step, a precedent will be used that has a valuation date corresponding to the previous month instead of the current month. Akin to the time shift example, at each time step, the date of a different time step is looked up from the precedent.
The results for this variable will be:
t | Date | VarAValnDateShiftTimeShift | Explanation |
---|---|---|---|
1 | January | N/A |
Look up from precedent with December valuation date, which is not in the series. |
2 | February | N/A |
Look up from precedent with January valuation date, which is not in the series. |
3 | March | \(x_3\) | Look up April in precedent with February valuation date, which is t=3 from precedent #1 . |
4 | April | \(y_3\) | Look up May in precedent with March valuation date, which is t=3 from precedent #2 . |
5 | May | \(z_3\) | Look up June in precedent with April valuation date, which is t=3 from precedent #3 . |
6 | June | \(z_4\) | Look up July in precedent with April valuation date, which is t=4 from precedent #3 . |