IRR
The purpose of IRR MathVariable is to provide configurors using a simple syntax to implement internal rate of return calculations. It will use the targeting logic to calculate an array of values representing the internal rate of return over a given period. It will use the targeting code to produce its output. The inputs to the routine are:
- Premium array
- Cash Flow array
- Mode
- Maximum # of trials
- Values array
To perform the IRR operation, a new MathVariable TYPE value will be created: IRR. There will be two steps to the operation, which will be indicated by OPERATION=”CREATE” and OPERATION=”SOLVE”.
IRR Creation and Initialization
To create and initialize the IRR object, use the “CREATE” OPERATION.
OPERATION="CREATE" | |
---|---|
Attribute | Description |
MODE |
The frequency of the regular payments during the year. Can be either 1 (annual), 2 (twice a year), 4 (quarterly) or 12 (monthly). |
PREMIUMARRAY | An array of annualized premiums of length N years. Assumed to be paid at the beginning of the period. |
CASHFLOWARRAY | Annual cash flow values: positive values (lump sum payments) and/or negative values (distributions). Assumed to be paid at the beginning of the year. |
XML Example
<MathVariable VARIABLENAME="MyIRR" TYPE="IRR" OPERATION="CREATE" MODE="Mode" PREMIUMARRAY="AnnualizedPremiumArray" CASHFLOWARRAY="CashFlowArray"/> |
This operation will initialize the IRR object by creating “modalized” arrays from the two “annualized” arrays; PREMIUMARRAY and CASHFLOWARRAY. In other words, both of the input arrays should contain one value per year of the calculation. The modalized arrays will have a length equal to the mode * length of the annualized arrays. So if the mode = 4, (quarterly payments), and the calculation is for 10 years, the modalized arrays will have 40 elements.
Once the IRR variable has been created, it can be used multiple times with a different set of input values to calculate IRR.
<MathVariable VARIABLENAME="MyIRR" TYPE="IRR" OPERATION="SOLVE" MAXTRIALS="50">ValuesArray</MathVariable> |
Attribute | Description |
MAXTRIALS | Maximum number of iterations to use when running the calculation |
text value (values array) | Annual values of length N years, with positive values representing the cash value or the death benefit. Assumed to be paid at the end of the year. Its size determines the number of years (N) for which IRR is calculated. |
When the solve operation is run, a check is made to ensure that the values array contains the same number of elements as the modalized arrays created with the CREATE operation. If not, the calculation fails and an exception is thrown.
The IRR calculation will use the Target operation to determine the proper input values needed to calculate the value in the values array.
To get the results of the calculation, use a variable of TYPE=”OBJECTFIELD”. The XML element content is the name of the field: IRR. Because the result is an array, this variable must first be declared as a NUMERICARRAY type.
<MathVariable VARIABLENAME="MyResults" TYPE="NUMBERICARRAY" DATATYPE="DECIMAL" OPERATION="CREATE">0</MathVariable> <MathVariable VARIABLENAME="MyResults" TYPE="OBJECTFIELD" SOURCEOBJECT="MyIRR">IRR</MathVariable> |