You are on page 1of 44

CTA

​Computational Tools
for Actuaries

HEC Lausanne - G. Zucchinetti


Abstract Model
Rules and variables
Excel
Giovanni Zucchinetti
giovanni.zucchinetti@gitec.ch

Adapted from the course « Notions informatiques – Modèles de calcul »


with kind permission from Prof. Yves Pigneur and Dr. Gabor Maksay

HEC Lausanne
Computanional Tools for Actuaries (CTA)
The following topics will be addressed
DESIGN
• Abstract computation model
• Dependency graph
• Input data, intermediate results, results
• Variables and rules
• Construction methodology

IMPLEMENTATION
• Translation of a model in a MS Excel spreadsheet
• Labels, data, formulas
• Named cells syntax
• Cell address syntax
• MIN Function

CTA - G. Zucchinetti 3
Development approach
Perceived
reality Description of the problem

Requirements analysis
Design Design of the model
Validation

Abstract
model Description of the problem

Implementation
Translation in a computer language

Spread- Solution for the problem ; uses for specific


sheet computations [Hainault 2002]

CTA - G. Zucchinetti 4
Description of a real-life problem

Net salary
Mr Muheim needs a tool in order to compute the net salary of an employee.
The following data are given :

- Gross salary
- AVS/AI contribution rate
- Accident insurance contribution rate
- Unemployement insurance contribution rate
- LPP contribution rate

CTA - G. Zucchinetti 5
Additional informations :

- AVS, accident and unemployment contributions correspond to the gross salary


multiplied by the contribution rate
- However, for the unemployment and accident insurances, the gross salary is
limited to CHF 126000
- The LPP insured salary is co-ordinated ; the gross salary is first limited to 3 * the
maximum AVS annuity (maxAVSA) (2015 : CHF 3 * 28 200 = 84 600) ; then a
coordination amount equal to 7/8 * maxAVSA(i.e. 7/8 * 28200) is substracted ; in
any case the minimum LPP insured salary is equal to 1/8 * maxAVSA
- The employee contribution = 50% of the total contribution
- The net salary is equal to the gross salary less the employee contribution

CTA - G. Zucchinetti 6
Table - Definitions

A B C D …
1
2
3
4

columns
rows

cell range

CTA - G. Zucchinetti 7
Table - Intermediate solution
Input data
       

Entry     Gross salary 70'000.00  


    AVS rate 10.00%  
    …  
         
  Intermediate variables    
    AVS contribution 7’000  
Calculate     …  
    Employee contr.
         
  Results      
    Net salary  
Calculate          
and publish

CTA - G. Zucchinetti 8
Abstract model - Definition

Abstraction
Abstractionin
in order
order to
todescribe,
describe, understand,
understand,
explain
explain or
or manage
manageaasituation
situation

Computational model
- quantitative variables
- computational relationships between these variables

CTA - G. Zucchinetti 9
Abstract model - Definition (II)

Description
Descriptionof
of aaproblem
problem with
withaa set
set of
of
••numerical
numericaland/
and/ or
or logical
logicalvariables
variables
••rules/formulas
rules/formulas thatthat help
help calculate
calculate results
results starting
starting
from
from the
the input
input variables
variables

CTA - G. Zucchinetti 10
Variable - Definition

Measurable
Measurableconcept
concept thatthat can
canbe
be
associated
associatedwith
withaa value
value
••often
often numeric
numeric
••sometimes
sometimeslogical
logical
••represented
representedby byaalabel
label

CTA - G. Zucchinetti 11
Variable - Intermediary solution
1) Gross salary : real salary before deductions

2) AVS rate : percent contribution rate for AVS/AI

3) AVS contribution : real contribution for AVS/AI

4) …

5) Employee contr. : real total employee contribution

6) Net salary : real salary paid to the employee

CTA - G. Zucchinetti 12
Dependencies graph - Definition

Variable A is directly dependent on variable B if :


A = f(B, …)
Transitivity

A B

B has an influence on A
B is part of the definition of A

CTA - G. Zucchinetti 13
Rule / Formula - Definition

Relationship
Relationship or
or rule
rulebetween
betweentwo
two
variables
variables

••often
often described
describedwith
with
-- aamathematical
mathematical expression
expression
-- or
oraalogical
logicalexpression
expression

CTA - G. Zucchinetti 14
Computation model - Definition

••set
set of
of input
input variables
variables
••set
set of
of output
output variables
variables

••set
set of
of formulas
formulas
defining
definingthe
the results
results as
asfunctions
functions of
of the
theinput
input variables
variables

Formula
Specification of a variable
- Left side : name of the variable to be defined
- Right side : definition of the variable

CTA - G. Zucchinetti 15
Dependency graph - Definition
Input data

Intermediate result

Result

CTA - G. Zucchinetti 16
Dependency graph and rules (I)

CTA - G. Zucchinetti 17
Dependency graph and rules (II)

Net salary =
Gross_salary –
Employee_contr

CTA - G. Zucchinetti 18
Dependency graph and rules (III)

Total contr =
AVS_contr + Acc_contr +
Unempl_contr + LPP_contr

Employee contr =
Total_contr *
Employee_cont_rate

CTA - G. Zucchinetti 19
Dependency graph and rules (IV)

Acc_salary =
Min(Gross_salary;126000)

Acc_contribution =
Acc_salary *
Acc_contr_rate

CTA - G. Zucchinetti 20
Model - Solution
1) Input data
- Gross salary : real : salary before deductions
- AVS rate : percent :contribution rate for AVS/AI
- …
2) Intermediate result
- AVS contribution: real : contribution for AVS/AI
- Acc salary : real : insured salary for acc. ins.
- Acc contribution: real : contribution for acc. ins.
- …
- Employee contr. : real : total employee contribution
3) Result
- Net salary : real : salary paid to the employee

CTA - G. Zucchinetti 21
Model - Solution
Rules / formulas
• AVS_salary = Gross_salary
• Acc_salary = MIN(Gross_salary;126000)
• maxAVSA = 28200
• LPP_salary = MAX(MIN(Gross_salary;maxAVSA * 3)-
maxAVSA * 7/8; maxAVSA/8)
• …
• AVS_contr = AVS_salary * AVS_contr_rate
• Acc_contr = Acc_salary * Acc_contr_rate
• …
• Total contr = AVS_contr + Acc_contr + Unempl_contr +
LPP_contr
• Employee contr = Total_contr * Employee_cont_rate
• Net salary = Gross_salary – Employee_contr

CTA - G. Zucchinetti 22
MS Excel - Labels
Edition

Formatting via
Format, Cellule, Motifs

CTA - G. Zucchinetti 23
MS Excel –
Solution : input
data
Edition

Formatting via
Format, Cellule, Nombre

CTA - G. Zucchinetti 24
MS Excel - Solution : cell names

Replace spaces and special characters like


operators (+,-,*…) with underscores or caps

CTA - G. Zucchinetti 25
MS Excel - Solution : formulas (named cells syntax)

Edit formula

CTA - G. Zucchinetti 26
MS Excel - Solution : formulas (named cells syntax)

Edit formula

CTA - G. Zucchinetti 27
MS Excel - Solution : functions

Menu, Insertion,
Fonction

Help

Arguments

CTA - G. Zucchinetti 28
MS Excel - Solution : formulas
Named cells syntax Cell addresses syntax

INPUT DATA
Gross salary 100000 =Gross_salary
AVS contribution rate 0.101 =AVS_contr_rate
Accident contribution rate 0.01231 =Acc_contr_rate
Unemployment contribution
rate 0.02 =Unempl_contr_rate
LPP contribution rate 0.1 =LPP_contr_rate
Employee cont rate 0.5 =Employee_cont_rate

INTERMEDIATE RESULT
AVS salary =Gross_salary =D4
Accident salary =MIN(Gross_salary;126000) =MIN(D4;126000)
Unemployment sal =MIN(Gross_salary;126000) =MIN(D4;126000)
LPP salary =MAX(MIN(Gross_salary;maxAVSA*3)-maxAVSA*7/8;maxAVSA/8) =MAX(MIN(D4;maxAVSA*3)-maxAVSA*7/8;max
AVS contribution =AVS_salary*AVS_contr_rate =D12*D5
Accident contribution =Acc_salary*Acc_contr_rate =D13*D6
Unemployment contribution =Unempl_sal*Unempl_contr_rate =D14*D7
LPP contribution =LPP_salary*LPP_contr_rate =D15*D8
Total contribution =AVS_contr+Acc_contr+Unempl_contr+LPP_contr =D16+D17+D18+D19
Employee contribution =Total_contr*Employee_cont_rate =D20*D9

RESULT
Net salary =Gross_salary-Employee_contr =D4-D21

CTA - G. Zucchinetti 29
MS Excel - Solution
Cell
Named cells
addresses
syntax
syntax

INPUT DATA
Gross salary 100'000 100'000
AVS contribution rate 10.10% 10.10%
Accident contribution rate 1.23% 1.23%
Unemployment contribution
2.00% 2.00%
rate
LPP contribution rate 10.00% 10.00%
Employee cont rate 50.00% 50.00%

INTERMEDIATE RESULT
AVS salary 100'000 100'000
Accident salary 100'000 100'000
Unemployment sal 100'000 100'000
LPP salary 59'925 59'925
AVS contribution 10'100 10'100
Accident contribution 1'231 1'231
Unemployment contribution 2'000 2'000
LPP contribution 5'993 5'993
Total contribution 19'324 19'324
Employee contribution 9'662 9'662

RESULT
Net salary 90'338 90'338

CTA - G. Zucchinetti 30
Names - Style guide
• Although each spreadsheet author develops his or her personal named-range
style, there are some guidelines we all can follow.
• Consistency
- Gross_salary, GrossSalary, … : although the particular style doesn’ t matter, pick one
and use it consistently so there is no question what it represents.
• Brevity
- Some formulas are long and complex and using long names makes the situation
worse. But don’t abbreviate too much. For example, A could mean many things, only one
of which is accident.
• Use of smart names
- Try to think of names you won’t have to change in each context.
• Specificity
- In a spreadsheet that has both Gross Salary and Net Salary, neither should be named
barely Salary. And if you do happen to specify Salary in a formula, Excel fortunately
will recognize the ambiguity and respond with this error message: #NAME?.
• Pronounceability
- Many people understand difficult or complex formulas by saying them aloud or by
sounding out the words in their minds. Prefer TaxRate to TaxRat !

• Make named ranges a habit. Don’t skip them just because a spreadsheet is
small, simple or because you think you don’t have enough time. Once you’re
familiar with them, you’ll find they always save you time in the long run.
CTA - G. Zucchinetti 31
Condition & Logic
Excel

Giovanni Zucchinetti
giovanni.zucchinetti@gitec.ch

Adapted from the course « Notions informatiques – Modèles de calcul »


with kind permission from Prof. Yves Pigneur and Dr. Gabor Maksay

HEC Lausanne
Description of a real-life problem
NAND salary
Mr Muheim would like the tool to compute the LPP contribution rate. The
following supplementary data are provided :
- Gross salary
- …
- Employee’s date of birth
- Date ofvaluation

Additional informations :
- …
- If the gross salary is less than 6/8 * the maximum AVS annuity (maxAVSA) then
the LPP insured salary is null
- For employees less than 25 years old, the contribution rate is null, between 25
and 34 : 7%, 35 - 44 : 10%, 45 – 54 : 15%, 55 – 65 : 18% ;
65 is the retirement age
- The age is the difference between the year of the valuation date and the year of
the date of birth

CTA - G. Zucchinetti 33
Multiple definition variable - Definition

• Selection of an expression under a specific


condition

• A variable is equal to

- « expression A » IF « condition A » (is TRUE)

-…

- « expression Z » OTHERWISE

(where « expression X » = « constant » OR « formula »)

CTA - G. Zucchinetti 34
Multiple definition variable - Solution

LPP_salary

= 0
IF Gross_salary < 6 / 8 * maxAVSA

= MAX(MIN(Gross_salary;maxAVSA * 3)- maxAVSA *


7/8; maxAVSA/8)
OTHERWISE

CTA - G. Zucchinetti 35
Multiple definition variable - Solution
LPP_contr_rate

= 7%
IF 25 <= Age < 35
= 10%
IF 35 <= Age < 45
= 15%
IF 45 <= Age < 55
= 18%
IF 55 <= Age <= 65
= 0
OTHERWISE

CTA - G. Zucchinetti 36
Dependency graph

CTA - G. Zucchinetti 37
MS Excel - Solution
Named cells Cell addresses
syntax syntax

INPUT DATA
Gross salary 100'000 100'000
AVS contribution rate 10.10% 10.10%
Accident contribution rate 1.23% 1.23%
Unemployment contribution rate 2.00% 2.00%
Employee cont rate 50.00% 50.00%
Valuation date 01.10.2015 01.10.2015
Date of birth 20.03.1971 20.03.1971

INTERMEDIATE RESULT
AVS salary 100'000 100'000
Accident salary 100'000 100'000
Unemployment sal 100'000 100'000
LPP salary 59'925 59'925
Employee LPP age 44 44
LPP contribution rate 10.00% 10.00%
AVS contribution 10'100 10'100
Accident contribution 1'231 1'231
Unemployment contribution 2'000 2'000
LPP contribution 5'993 5'993
Total contribution 19'324 19'324
Employee contribution 9'662 9'662

RESULT
Net salary 90'338 90'338

CTA - G. Zucchinetti 38
MS Excel - Function IF (si)

IF (SI) function syntax


= SI(condition ; expression if TRUE ; expression if FALSE)

CTA - G. Zucchinetti 39
MS Excel - Formulas

LPP_contr_rate :

=SI(Age<25;0;SI(Age<35;7%;SI(Age<45;10%;SI(A
ge<55;15%; SI(Age<=65;18%;0)))))

CTA - G. Zucchinetti 40
Logic - Definition
p NOT p

true false

false true

p q p AND q p q p OR q

true true true true true true

true false false true false true

false true false false true true

false false false false false false

CTA - G. Zucchinetti 41
MS Excel - Functions translation table
English French Dutch German Spanish Finnish Italian
ABS ABS ABS ABS ABS ITSEISARVO ASS
INITIATE ACCEDER KANAAL.OPENEN KANAL.ÖFFNEN INICIAR AVAA.KANAVA DDE.APRI
ACOS ACOS BOOGCOS ARCCOS ACOS ACOS ARCCOS
ACOSH ACOSH BOOGCOSH ARCCOSHYP ACOSH ACOSH ARCCOSH
ENABLE.TOOL ACTIVER.OUTIL KNOP.ACTIVERENSYMBOL.AKTIVIEREN
HABILITAR.HERRAMIENTA
KÄYTÄ.TYÖKALU ATTIVA.STRUMENTO
ADDRESS ADRESSE ADRES ADRESSE DIRECCION OSOITE INDIRIZZO
SHOW.BAR AFFICHER.BARRE BALK.TONEN MENÜLEISTE.ZEIGEN
MOSTRAR.BARRA NÄYTÄ.VALRIVI BARRA.MOSTRA
HELP AIDE HULP HILFE AYUDA OHJE GUIDA
ADD.BAR AJOUTER.BARRE BALK.TOEVOEGENMENÜLEISTE.EINFÜGEN
AGREGAR.BARRA LISÄÄ.VALRIVI BARRA.AGGIUNGI
ADD.TOOLBAR AJOUTER.BARRE.OUTILS WERKBALK.TOEVOEGEN
SYMBOLLEISTE.EINFÜGEN
AGREGAR.BARRA.HERRAMIENTAS
LISÄÄ.TYÖKALURIVI
BARRA.DEGLI.STRUM
ADD.COMMAND AJOUTER.COMMANDE OPDRACHT.TOEVOEGEN
BEFEHL.EINFÜGENAGREGAR.COMANDO LISÄÄ.KOMENTO COMANDO.AGGIUNGI
PIVOT.ADD.DATA AJOUTER.DONNEES.TABLEAU.CROISE
DRAAITABEL.GEGEVENS.TOEV
PIVOT.DATEN.HINZUFÜGEN
TABLA.DI.ADICIONAR.DATOS
PIVOT.LISÄÄ PIVOT.AGGIUNGI.DAT
ADD.MENU AJOUTER.MENU MENU.TOEVOEGEN MENÜ.EINFÜGEN AGREGAR.MENU LISÄÄ.VALIKKO MENU.AGGIUNGI
RAND ALEA ASELECT ZUFALLSZAHL ALEATORIO SATUNNAISLUKU CASUALE
SLN AMORLIN LIN.AFSCHR LIA SLN STP AMMORT.COST
YEAR ANNEE JAAR JAHR AÑO VUOSI ANNO
CUSTOM.UNDO ANNULER.PERSONNALISE ONGEDAAN.MAKEN.AANGEPAST
BENUTZERDEFINIERT.RÜCKGÄNGIG
PERSONALIZAR.DESHACER
OMA.KUMOA PERSONAL.ANNULLA
APP.TITLE APP.TITRE TITEL.TOEPASSING
ANW.TITEL APL.TITULO SOV.OTSIKKO APPLICAZ.TITOLO
ARGUMENT ARGUMENT ARGUMENT ARGUMENT ARGUMENTO ARGUMENTTI ARGOMENTO
HALT ARRETER STOPPEN STOP DETENER SEIS FERMA
ROUND ARRONDI AFRONDEN RUNDEN REDONDEAR PYÖRISTÄ ARROTONDA

CTA - G. Zucchinetti 42
MS Excel - Functions, arguments, help

CTA - G. Zucchinetti 43
References
• [Maksay 08] Maksay Gabor, Pigneur Yves, Modéliser par l'exemple, Presses
polytechniques et universitaires romande, 2008,
http://www.ppur.org/produit/290/9782880748951/Modeliser%20par
%20lexemple%20

• [Seref 07] Michelle M.H. Şeref, Ravindra K. Ahuja, and Wayne L. Winston ;
Developing Spreadsheet-Based Decision Support Systems Using Excel and
VBA for Excel ; Dynamic Ideas, Belmont, Massachusetts 2007

• [Hainault 02], Jean-Luc Hainault, Bases de données et modèles de calcul (3ème


édition), Dunod, 2002

CTA - G. Zucchinetti 44

You might also like