APL for Financial Calculations
Vector 6:3, page 76
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 76
In 1982, in a contribution to a colloquium on non-life insurance (XVI ASTIN Colloquium, Liege), the Swiss actuary J.A. Bardola concluded that APL was a very attractive programming language for non-life insurance problems.
In a paper to the International Congress of Actuaries (Sydney, 1984), the French Actuary L. Moreau described the use of APL in the French insurance company Assurances Generales de France (AGF) - one of the largest insurance companies in France. The uses to which APL was put were:
- the development of APL functions to calculate all actuarial functions - the ‘pocket actuary’;
- a system of forecasting financial accounts whereby the accounts for subsequent years were simulated on the basis of certain assumptions;
- a model simulating the ‘life’ of 10,000 insurance policies and calculating the profitability of the portfolio of policies;
- the checking of mortality tables;
- the analysis of the mortality and surrender experience of policies.
A book entitled "APL, the Language and its Actuarial Applications", by S. Stiers, M.J. Goovaerts and J.de Kerf (North Holland) was published in 1987. One of the authors, M.J. Goovaerts, is Professor of Actuarial Mathematics at the University of Leuven (Belgium) and at the University of Amsterdam. The book contains a wealth of examples of the application of APL to problems in finance, life and non-life insurance, credibility theory, statistics, numerical analysis etc.
Papers on the application of APL to insurance problems have also appeared in the journal of the German Actuarial Society. A paper will soon be appearing in the Journal of the Institute of Actuaries (by the author of this note).
There are now a substantial number of financial institutions (insurance companies, insurance brokers, banks, hire purchase companies etc.) in the UK using APL. As will be seen from the references referrred to above there is considerable use in Europe of APL for insurance calculations; indeed its use on the continent may well exceed that in the UK.
The syntax of APL lends itself very well to financial problems - in a sense APL may be described as a natural language for the solution of financial problems. The vector, matrix, multi-dimensional array structure of the language, the special symbols and the use of simple functions as building blocks to more complex functions can be exploited in powerful ways.
We may take a very simple example as an illustration.
We suppose that an insurance company undertakes to make annual payments of £1 on an annuity policy at the end of each of the next n years.
For those readers who remember their compound interest the present value of these payments is:
where i is the rate of interest, or in APL:
If the payments, instead of being £1 at the end of each of the years, are (a1,a2,a3……an) then the value ot the payments is +/A×(÷1+I)*⍳N
If the rate of interest is not i, but varies from year to year, being i1,i2,……in during each of the next n years, then the same APL expression holds with I being the vector (i1,i2,……in).
The above is a very simple example of the great economy of expression, without loss of clarity that can be obtained for the solution of financial problems in APL.
My own insurance company (the Scottish Widows’ Fund) uses APL in the Actuarial Department and in the Pensions Department. The Actuarial Department makes extensive use of APL as follows:
- Calculation of actuarial functions (the ‘pocket actuary’).
- Calculation of premium rates on different actuarial bases - the actuarial assumptions underlying the rates may be changed interactively and the effect on the rates can be seen immediately.
- Profit testing of unit-linked products.
- Solution of miscellaneous actuarial problems, by developing appropriate APL functions. These can usually be developed very quickly.
- A system is available to our branch offices to enable them to request from their branch terminals premium and annuity rates. The system is menu driven and written (in APL) and maintained by the Actuarial Department - with no reference to IT Department apart from the general security/supervisory role. The rates are calculated, when requested, directly from the underlying actuarial bases. Printed books of tables of rates would be so voluminous as to be impracical.
- Modelling of the office as a whole. The assets and liabilities of the office are entered into the model which can be run forward either deterministically or stochastically on different future financial scenarios and different bonus strategies investigated and their effect on statutory solvency ratios determined etc.
It has been our experience that actuarial students have had little difficulty learning APL. They have enjoyed using it as they as they have recognised its power to solve financial problems. The use of APL in the Actuarial Department has enabled productivity in certain areas of the department to increase by a factor of between two and three.