SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
R for Car
Insurance
Product
Claudio G. Giancaterino
29/11/2016
Zurich R User Group - Meetup
Motor Third Party Liability
Pricing
By the Insurance contract, economic risk is transferred
from the policyholder to the Insurer
Theoretical Approach
 P=E(X)=E(N)*E(Z)
 P=Risk Premium
 X=Global Loss
 E(N)=claim frequency
 E(Z)=claim severity
 Hp:
 1) cost of claims are i.i.d.
 2) indipendence between number of claims
and cost of claims
From Technical Tariff to
Commercial Tariff
Tariff variables
 P=Pcoll*Yh*Xi*Zj=Technical Tariff
risk coefficients statistical models are employed
 Pt=P*(1+λ)/(1-H)=Commercial Tariff
 λ=Safety Loading Rate
 H=Loading Rate
 P is adjusted by tariff requirement
Dataset “ausprivauto0405”
within CASdatasets R
package
 Statistics
> str(ausprivauto0405)
'data.frame': 67856 obs. of 9 variables:
$ Exposure: num 0.304 0.649 0.569 0.318 0.649 ...
$ VehValue: num 1.06 1.03 3.26 4.14 0.72 2.01 1.6 1.47 0.52
$ VehAge: Factor w/ 4 levels "old cars","oldest cars",..: 1 3 3 3 2
$ VehBody: Factor w/ 13 levels "Bus","Convertible",..: 5 5 13 11 5
$ Gender: Factor w/ 2 levels "Female","Male": 1 1 1 1 1 2 2 2 1
$ DrivAge: Factor w/ 6 levels "old people","older work. people",..: 5 2 5 5
$ ClaimOcc: int 0 0 0 0 0 0 0 0 0 0 ...
$ ClaimNb: int 0 0 0 0 0 0 0 0 0 0 ...
$ ClaimAmount: num 0 0 0 0 0 0 0 0 0 0 ...
> table(VehAge,useNA="always")
VehAge
old cars oldest cars young cars youngest cars <NA>
20064 18948 16587 12257 0
> table(DrivAge,useNA="always")
DrivAge
old people older work. people oldest people working people
10736 16189 6547 15767
young people youngest people <NA>
12875 5742 0
> table(VehBody,useNA="always")
VehBody
Bus Convertible Coupe Hardtop
48 81 780 1579
Hatchback Minibus Motorized caravan Panel van
18915 717 127 752
Roadster Sedan Station wagon Truck
27 22233 16261 1750
Utility <NA>
4586 0
> library(Amelia)
> missmap(ausprivauto0405)
#mean frequency#
> MClaims<-with(rc, sum(ClaimNb)/sum(Exposure))
> MClaims
[1] 0.5471511
 
#mean severity#
> MACost<-with(rc, sum(ClaimAmount)/sum(ClaimNb))
> MACost
[1] 287.822
 
#mean risk premium#
> MPremium<-with(rc, sum(ClaimAmount)/sum(Exposure))
> MPremium
[1] 157.4821
> actuallosses<-with(rc.f, sum(ClaimAmount))
> actuallosses
[1] 9342125
> library(ggplot2)
> ggplot(rc, aes(x = AgeCar))+geom_histogram(stat="bin", bins=30)
> ggplot(rc, aes(x = BodyCar))+geom_histogram(stat="bin", bins=30)
> ggplot(rc, aes(x = AgeDriver))+geom_histogram(stat="bin", bins=30)
> ggplot(rc, aes(x = VehValue))+geom_histogram(stat="bin", bins=30
> boxplot(rc$AgeCar,rc$BodyCar,rc$VehValue,rc$AgeDriver,
+ xlab="AgeCar BodyCar VehValue AgeDriver")
Cluster Analysis by k-means
#Prepare Data
> rc.stand<-scale(rc[-1]) # To standardize the variables
#Determine number of clusters
> nk = 2:10
> WSS = sapply(nk, function(k) {
+ kmeans(rc.stand, centers=k)$tot.withinss
+ })
> plot(nk, WSS, type="l", xlab="Number of Clusters",
+ ylab="Within groups sum of squares")
#k-means with k = 7 solutions
> k.means.fit <- kmeans(rc.stand, 7)
2 4 6 8 10
6000080000100000120000140000
Number of Clusters
Withingroupssumofsquares
Generalized Linear Models
(GLM)Yi~EF(b(θi);Φ/ωi) g(μi)=ηi ηi=Σjxijβj
Random Component Link Systematic Component
Linear Models are extended in
two directions:
Probability distribution:
Output variables are stochastically
independent with the same exponential
family distribution.
Expected value:
There is a link function between
expected value of outputs and covariates
that could be different from linear
regression.
GLM Analysis
Univariate Approach
#stochastic risk premium with GLM approach#
> PRSModglm1<-glm(RiskPremium1~AgeCar+BodyCar+VehValue+AgeDriver,
+ weights=Exposure, data=rc.f, family=gaussian(link=log))
> GLMSRiskPremium1<-predict(PRSModglm1,data=rc.f,type="response")
Multivariate Approach
#stochastic risk premium with GLM approach#
> PRSModglm2<-glm(RiskPremium2~AgeCar*BodyCar*VehValue*AgeDriver,
+ weights=Exposure, data=rc, family=gaussian(link=log))
> GLMSRiskPremium2<-predict(PRSModglm2,data=rc,type="response")
Generalized NonLinear
Models (GNM)
Yi~EF(b(θi);Φ/ωi) g(μi)=ηi(xij;βj) ηi=Σjxijβj
Random Component Link Systematic Component
Generalized Linear Models are extended
in the link function where the
systematic component is non linear
in the parameters βj.
It can be considered an extension of
nonlinear least squares model, where the
variance of the output depend on the mean.
Difficult are in starting values, they are
generated randomly for non linear
parameters and using a GLM fit for linear
parameters.
GNM Analysis
Univariate Approach
> library(gnm)
#stochastic risk premium with GNM approach#
> PRSModgnm1<-gnm(RiskPremium1~AgeCar+BodyCar+VehValue+AgeDriver,
+ weights=Exposure, data=rc.f, family=Gamma(link=log))
> GNMSRiskPremium1<-predict(PRSModgnm1,data=rc.f,type="response")
Multivariate Approach
> #stochastic risk premium with GNM approach#
> PRSModgnm2<-gnm(RiskPremium2~VehValue*AgeDriver*AgeCar*BodyCar,
+ weights=Exposure, data=rc, family=Gamma(link=log))
> GNMSRiskPremium2<-predict(PRSModgnm2,data=rc,type="response")
Generalized Additive
Models (GAM)
Yi~EF(b(θi);Φ/ωi) g(μi)=ηi ηi= Σpxipβip+Σjfj(xij)
Random Component Link Systematic Component
Generalized additive models extend
generalized linear models in the predictor:
systematic component is made up by one
parametric part and one non parametric part
built by the sum of unknown “smoothing”
functions of the covariates.
For the estimators are used splines,
functions made up by combination of
little polynomial segment joined in knots.
GAM Analysis
Univariate Approach
> library(mgcv)
#stochastic risk premium with GAM approach#
> PRSModgam1<-gam(RiskPremiumgam1~s(AgeCar, bs="cc", k=4)
+ +s(BodyCar, bs="cc", k=12)+s(VehValue, bs="cc", k=30)
+ +s(AgeDriver, bs="cc", k=6), weights=Exposure, data=rc,
+ family=Gamma(link=log))
> GAMSRiskPremium1<-predict(PRSModgam1,data=rc,type="response")
Multivariate Approach
> #stochastic risk premium with GAM approach#
> PRSModgam2<gam(RiskPremiumgam2~te(BodyCar,VehValue,AgeDriver,AgeCar,
+ k=4),weights=Exposure, data=rc, family="Gamma"(link=log))
> GAMSRiskPremium2<-predict(PRSModgam2,data=rc,type="response")
> rc$GAMSRiskPremium2<-with(rc, GAMSRiskPremium2)
Mean
commercial
tariff
Tariff
requirement
Loss Ratio
Residuals
degrees of
freedom
Expected
Losses
Actual
Losses
Explained
Deviance
Risk
coefficients
Uni- GLM 234,4587 1,000490 1,447822 27.501 9.337.547 9.342.125 96,96% 20
Variate GNM 234,4647 1,000476 1,447785 27.501 9.337.683 9.342.125 96,96% 20
Analysis GAM 232,8702 1,001729 1,457698 27.476 9.325.999 9.342.125 96,20% 45
Multi-
GLM 234,6486 0,9981246 1,446650 27.505 9.359.678 9.342.125 87,64% 16
Variate
GNM 234,6165 0,9979703 1,446848 27.505 9.361.125 9.342.125 87,04% 16
Analysis
GAM 248,5732 0,8596438 1,365612 27.265 10.867.438 9.342.125 84,80% 256
Results
GLM vs GAM vs GNM
Approaches
GLM GAM GNM
Strengths: -User-friendly -Flexible to fit data -Afford some
-Faster elaboration -Realistic values elaboration
-Usually low level of excluded by GLM
residual deviance
-More risk coefficients -Better values
despite GLM
Weakness: -Poor flexibility -Complex to realize -Complex to use
to fit data
-Usually higher
values of residual
deviance
-Overestimed values
References
 C.G. Giancaterino - GLM, GNM and GAM Approaches on MTPL Pricing -
Journal of Mathematics and Statistical Science – 08/2016
http://www.ss-pub.org/journals/jmss/vol-2/vol-2-issue-8-august-2016/
 X.Marechal & S. Mahy – Advanced Non Life Pricing – EAA Seminar
 N. Savelli & G.P. Clemente – Lezioni di Matematica Attuariale delle
Assicurazioni Danni – Educatt
Many Thanks for your Attention!!!
Contact:
Claudio G. Giancaterino
c.giancaterino@gmail.com

Contenu connexe

Tendances

MITCOE 2011-12 conm-submission
MITCOE 2011-12 conm-submissionMITCOE 2011-12 conm-submission
MITCOE 2011-12 conm-submissionAshutosh Katti
 
Design of a novel controller to increase the frequency response of an aerospace
Design of a novel controller to increase the frequency response of an aerospaceDesign of a novel controller to increase the frequency response of an aerospace
Design of a novel controller to increase the frequency response of an aerospaceIAEME Publication
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
HMPC for Upper Stage Attitude Control
HMPC for Upper Stage Attitude ControlHMPC for Upper Stage Attitude Control
HMPC for Upper Stage Attitude ControlPantelis Sopasakis
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
Curve fitting and Optimization
Curve fitting and OptimizationCurve fitting and Optimization
Curve fitting and OptimizationSyahrul Senin
 
(Full MatLab Code) Image compression DCT
(Full MatLab Code) Image compression DCT(Full MatLab Code) Image compression DCT
(Full MatLab Code) Image compression DCTChaudhary Sarimurrab
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexityparamita30
 

Tendances (20)

MITCOE 2011-12 conm-submission
MITCOE 2011-12 conm-submissionMITCOE 2011-12 conm-submission
MITCOE 2011-12 conm-submission
 
Critical Path Method
Critical Path MethodCritical Path Method
Critical Path Method
 
Design of a novel controller to increase the frequency response of an aerospace
Design of a novel controller to increase the frequency response of an aerospaceDesign of a novel controller to increase the frequency response of an aerospace
Design of a novel controller to increase the frequency response of an aerospace
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
HMPC for Upper Stage Attitude Control
HMPC for Upper Stage Attitude ControlHMPC for Upper Stage Attitude Control
HMPC for Upper Stage Attitude Control
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Curve fitting and Optimization
Curve fitting and OptimizationCurve fitting and Optimization
Curve fitting and Optimization
 
(Full MatLab Code) Image compression DCT
(Full MatLab Code) Image compression DCT(Full MatLab Code) Image compression DCT
(Full MatLab Code) Image compression DCT
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Amortized complexity
Amortized complexityAmortized complexity
Amortized complexity
 
Topic 4.1
Topic 4.1Topic 4.1
Topic 4.1
 
Topic 2
Topic 2Topic 2
Topic 2
 
Ceske budevice
Ceske budeviceCeske budevice
Ceske budevice
 
Topic 1.2
Topic 1.2Topic 1.2
Topic 1.2
 
04 Algorithms
04 Algorithms04 Algorithms
04 Algorithms
 

Similaire à R Models for Car Insurance Pricing

R/Finance 2009 Chicago
R/Finance 2009 ChicagoR/Finance 2009 Chicago
R/Finance 2009 Chicagogyollin
 
Introducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conferenceIntroducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conferenceThierry Moudiki
 
Relevance of Particle Swarm Optimization Technique for the Solution of Econom...
Relevance of Particle Swarm Optimization Technique for the Solution of Econom...Relevance of Particle Swarm Optimization Technique for the Solution of Econom...
Relevance of Particle Swarm Optimization Technique for the Solution of Econom...IRJET Journal
 
Economic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration MethodEconomic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration MethodIOSR Journals
 
Generalized Nonlinear Models in R
Generalized Nonlinear Models in RGeneralized Nonlinear Models in R
Generalized Nonlinear Models in Rhtstatistics
 
Efficient equity portfolios using mean variance optimisation in R
Efficient equity portfolios using mean variance optimisation in REfficient equity portfolios using mean variance optimisation in R
Efficient equity portfolios using mean variance optimisation in RGregg Barrett
 
COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...
COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...
COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...cscpconf
 
Distributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUsDistributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUsPantelis Sopasakis
 
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfConsider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfmeerobertsonheyde608
 
R Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RR Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RRsquared Academy
 
MH prediction modeling and validation in r (2) classification 190709
MH prediction modeling and validation in r (2) classification 190709MH prediction modeling and validation in r (2) classification 190709
MH prediction modeling and validation in r (2) classification 190709Min-hyung Kim
 
6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demoNAP Events
 
BIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabBIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabShiv Koppad
 
presentation
presentationpresentation
presentation3ashmawy
 

Similaire à R Models for Car Insurance Pricing (20)

R logistic regression
R   logistic regressionR   logistic regression
R logistic regression
 
R/Finance 2009 Chicago
R/Finance 2009 ChicagoR/Finance 2009 Chicago
R/Finance 2009 Chicago
 
Introducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conferenceIntroducing R package ESG at Rmetrics Paris 2014 conference
Introducing R package ESG at Rmetrics Paris 2014 conference
 
Risk modeling prortfolio diversification 4.0
Risk modeling prortfolio diversification 4.0Risk modeling prortfolio diversification 4.0
Risk modeling prortfolio diversification 4.0
 
Relevance of Particle Swarm Optimization Technique for the Solution of Econom...
Relevance of Particle Swarm Optimization Technique for the Solution of Econom...Relevance of Particle Swarm Optimization Technique for the Solution of Econom...
Relevance of Particle Swarm Optimization Technique for the Solution of Econom...
 
Economic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration MethodEconomic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration Method
 
Generalized Nonlinear Models in R
Generalized Nonlinear Models in RGeneralized Nonlinear Models in R
Generalized Nonlinear Models in R
 
Efficient equity portfolios using mean variance optimisation in R
Efficient equity portfolios using mean variance optimisation in REfficient equity portfolios using mean variance optimisation in R
Efficient equity portfolios using mean variance optimisation in R
 
COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...
COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...
COMBINED ECONOMIC AND EMISSION DISPATCH WITH AND WITHOUT CONSIDERING TRANSMIS...
 
Distributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUsDistributed solution of stochastic optimal control problem on GPUs
Distributed solution of stochastic optimal control problem on GPUs
 
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdfConsider a 4-Link robot manipulator shown below. Use the forward kine.pdf
Consider a 4-Link robot manipulator shown below. Use the forward kine.pdf
 
R Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RR Programming: Mathematical Functions In R
R Programming: Mathematical Functions In R
 
report_2_v2
report_2_v2report_2_v2
report_2_v2
 
MUMS: Transition & SPUQ Workshop - Practical Bayesian Optimization for Urban ...
MUMS: Transition & SPUQ Workshop - Practical Bayesian Optimization for Urban ...MUMS: Transition & SPUQ Workshop - Practical Bayesian Optimization for Urban ...
MUMS: Transition & SPUQ Workshop - Practical Bayesian Optimization for Urban ...
 
MH prediction modeling and validation in r (2) classification 190709
MH prediction modeling and validation in r (2) classification 190709MH prediction modeling and validation in r (2) classification 190709
MH prediction modeling and validation in r (2) classification 190709
 
6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo
 
BIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using MatlabBIometrics- plotting DET and EER curve using Matlab
BIometrics- plotting DET and EER curve using Matlab
 
presentation
presentationpresentation
presentation
 
Article 1
Article 1Article 1
Article 1
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 

Plus de Zurich_R_User_Group

Anomaly detection - database integrated
Anomaly detection - database integratedAnomaly detection - database integrated
Anomaly detection - database integratedZurich_R_User_Group
 
R at Sanitas - Workflow, Problems and Solutions
R at Sanitas - Workflow, Problems and SolutionsR at Sanitas - Workflow, Problems and Solutions
R at Sanitas - Workflow, Problems and SolutionsZurich_R_User_Group
 
Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...
Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...
Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...Zurich_R_User_Group
 
Introduction to Renjin, the alternative engine for R
Introduction to Renjin, the alternative engine for R Introduction to Renjin, the alternative engine for R
Introduction to Renjin, the alternative engine for R Zurich_R_User_Group
 
How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...
How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...
How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...Zurich_R_User_Group
 
Where South America is Swinging to the Right: An R-Driven Data Journalism Pr...
Where South America is Swinging to the Right:  An R-Driven Data Journalism Pr...Where South America is Swinging to the Right:  An R-Driven Data Journalism Pr...
Where South America is Swinging to the Right: An R-Driven Data Journalism Pr...Zurich_R_User_Group
 
Visualization Challenge: Mapping Health During Travel
Visualization Challenge: Mapping Health During TravelVisualization Challenge: Mapping Health During Travel
Visualization Challenge: Mapping Health During TravelZurich_R_User_Group
 
Zurich R User group: Desc tools
Zurich R User group: Desc tools Zurich R User group: Desc tools
Zurich R User group: Desc tools Zurich_R_User_Group
 
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table packageJanuary 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table packageZurich_R_User_Group
 
December 2015 Meetup - Shiny: Make Your R Code Interactive - Craig Wang
December 2015 Meetup - Shiny: Make Your R Code Interactive - Craig WangDecember 2015 Meetup - Shiny: Make Your R Code Interactive - Craig Wang
December 2015 Meetup - Shiny: Make Your R Code Interactive - Craig WangZurich_R_User_Group
 

Plus de Zurich_R_User_Group (11)

Anomaly detection - database integrated
Anomaly detection - database integratedAnomaly detection - database integrated
Anomaly detection - database integrated
 
R at Sanitas - Workflow, Problems and Solutions
R at Sanitas - Workflow, Problems and SolutionsR at Sanitas - Workflow, Problems and Solutions
R at Sanitas - Workflow, Problems and Solutions
 
Modeling Bus Bunching
Modeling Bus BunchingModeling Bus Bunching
Modeling Bus Bunching
 
Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...
Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...
Visualizing the frequency of transit delays using QGIS and the Leaflet javasc...
 
Introduction to Renjin, the alternative engine for R
Introduction to Renjin, the alternative engine for R Introduction to Renjin, the alternative engine for R
Introduction to Renjin, the alternative engine for R
 
How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...
How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...
How to use R in different professions: R In Finance (Speaker: Gabriel Foix, M...
 
Where South America is Swinging to the Right: An R-Driven Data Journalism Pr...
Where South America is Swinging to the Right:  An R-Driven Data Journalism Pr...Where South America is Swinging to the Right:  An R-Driven Data Journalism Pr...
Where South America is Swinging to the Right: An R-Driven Data Journalism Pr...
 
Visualization Challenge: Mapping Health During Travel
Visualization Challenge: Mapping Health During TravelVisualization Challenge: Mapping Health During Travel
Visualization Challenge: Mapping Health During Travel
 
Zurich R User group: Desc tools
Zurich R User group: Desc tools Zurich R User group: Desc tools
Zurich R User group: Desc tools
 
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table packageJanuary 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
 
December 2015 Meetup - Shiny: Make Your R Code Interactive - Craig Wang
December 2015 Meetup - Shiny: Make Your R Code Interactive - Craig WangDecember 2015 Meetup - Shiny: Make Your R Code Interactive - Craig Wang
December 2015 Meetup - Shiny: Make Your R Code Interactive - Craig Wang
 

Dernier

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 

Dernier (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

R Models for Car Insurance Pricing

  • 1. R for Car Insurance Product Claudio G. Giancaterino 29/11/2016 Zurich R User Group - Meetup
  • 2. Motor Third Party Liability Pricing By the Insurance contract, economic risk is transferred from the policyholder to the Insurer
  • 3. Theoretical Approach  P=E(X)=E(N)*E(Z)  P=Risk Premium  X=Global Loss  E(N)=claim frequency  E(Z)=claim severity  Hp:  1) cost of claims are i.i.d.  2) indipendence between number of claims and cost of claims
  • 4. From Technical Tariff to Commercial Tariff Tariff variables  P=Pcoll*Yh*Xi*Zj=Technical Tariff risk coefficients statistical models are employed  Pt=P*(1+λ)/(1-H)=Commercial Tariff  λ=Safety Loading Rate  H=Loading Rate  P is adjusted by tariff requirement
  • 5. Dataset “ausprivauto0405” within CASdatasets R package  Statistics > str(ausprivauto0405) 'data.frame': 67856 obs. of 9 variables: $ Exposure: num 0.304 0.649 0.569 0.318 0.649 ... $ VehValue: num 1.06 1.03 3.26 4.14 0.72 2.01 1.6 1.47 0.52 $ VehAge: Factor w/ 4 levels "old cars","oldest cars",..: 1 3 3 3 2 $ VehBody: Factor w/ 13 levels "Bus","Convertible",..: 5 5 13 11 5 $ Gender: Factor w/ 2 levels "Female","Male": 1 1 1 1 1 2 2 2 1 $ DrivAge: Factor w/ 6 levels "old people","older work. people",..: 5 2 5 5 $ ClaimOcc: int 0 0 0 0 0 0 0 0 0 0 ... $ ClaimNb: int 0 0 0 0 0 0 0 0 0 0 ... $ ClaimAmount: num 0 0 0 0 0 0 0 0 0 0 ...
  • 6. > table(VehAge,useNA="always") VehAge old cars oldest cars young cars youngest cars <NA> 20064 18948 16587 12257 0 > table(DrivAge,useNA="always") DrivAge old people older work. people oldest people working people 10736 16189 6547 15767 young people youngest people <NA> 12875 5742 0 > table(VehBody,useNA="always") VehBody Bus Convertible Coupe Hardtop 48 81 780 1579 Hatchback Minibus Motorized caravan Panel van 18915 717 127 752 Roadster Sedan Station wagon Truck 27 22233 16261 1750 Utility <NA> 4586 0
  • 8. #mean frequency# > MClaims<-with(rc, sum(ClaimNb)/sum(Exposure)) > MClaims [1] 0.5471511   #mean severity# > MACost<-with(rc, sum(ClaimAmount)/sum(ClaimNb)) > MACost [1] 287.822   #mean risk premium# > MPremium<-with(rc, sum(ClaimAmount)/sum(Exposure)) > MPremium [1] 157.4821 > actuallosses<-with(rc.f, sum(ClaimAmount)) > actuallosses [1] 9342125
  • 9. > library(ggplot2) > ggplot(rc, aes(x = AgeCar))+geom_histogram(stat="bin", bins=30) > ggplot(rc, aes(x = BodyCar))+geom_histogram(stat="bin", bins=30) > ggplot(rc, aes(x = AgeDriver))+geom_histogram(stat="bin", bins=30) > ggplot(rc, aes(x = VehValue))+geom_histogram(stat="bin", bins=30
  • 10.
  • 12. Cluster Analysis by k-means #Prepare Data > rc.stand<-scale(rc[-1]) # To standardize the variables #Determine number of clusters > nk = 2:10 > WSS = sapply(nk, function(k) { + kmeans(rc.stand, centers=k)$tot.withinss + }) > plot(nk, WSS, type="l", xlab="Number of Clusters", + ylab="Within groups sum of squares") #k-means with k = 7 solutions > k.means.fit <- kmeans(rc.stand, 7)
  • 13. 2 4 6 8 10 6000080000100000120000140000 Number of Clusters Withingroupssumofsquares
  • 14. Generalized Linear Models (GLM)Yi~EF(b(θi);Φ/ωi) g(μi)=ηi ηi=Σjxijβj Random Component Link Systematic Component Linear Models are extended in two directions: Probability distribution: Output variables are stochastically independent with the same exponential family distribution. Expected value: There is a link function between expected value of outputs and covariates that could be different from linear regression.
  • 15. GLM Analysis Univariate Approach #stochastic risk premium with GLM approach# > PRSModglm1<-glm(RiskPremium1~AgeCar+BodyCar+VehValue+AgeDriver, + weights=Exposure, data=rc.f, family=gaussian(link=log)) > GLMSRiskPremium1<-predict(PRSModglm1,data=rc.f,type="response") Multivariate Approach #stochastic risk premium with GLM approach# > PRSModglm2<-glm(RiskPremium2~AgeCar*BodyCar*VehValue*AgeDriver, + weights=Exposure, data=rc, family=gaussian(link=log)) > GLMSRiskPremium2<-predict(PRSModglm2,data=rc,type="response")
  • 16. Generalized NonLinear Models (GNM) Yi~EF(b(θi);Φ/ωi) g(μi)=ηi(xij;βj) ηi=Σjxijβj Random Component Link Systematic Component Generalized Linear Models are extended in the link function where the systematic component is non linear in the parameters βj. It can be considered an extension of nonlinear least squares model, where the variance of the output depend on the mean. Difficult are in starting values, they are generated randomly for non linear parameters and using a GLM fit for linear parameters.
  • 17. GNM Analysis Univariate Approach > library(gnm) #stochastic risk premium with GNM approach# > PRSModgnm1<-gnm(RiskPremium1~AgeCar+BodyCar+VehValue+AgeDriver, + weights=Exposure, data=rc.f, family=Gamma(link=log)) > GNMSRiskPremium1<-predict(PRSModgnm1,data=rc.f,type="response") Multivariate Approach > #stochastic risk premium with GNM approach# > PRSModgnm2<-gnm(RiskPremium2~VehValue*AgeDriver*AgeCar*BodyCar, + weights=Exposure, data=rc, family=Gamma(link=log)) > GNMSRiskPremium2<-predict(PRSModgnm2,data=rc,type="response")
  • 18. Generalized Additive Models (GAM) Yi~EF(b(θi);Φ/ωi) g(μi)=ηi ηi= Σpxipβip+Σjfj(xij) Random Component Link Systematic Component Generalized additive models extend generalized linear models in the predictor: systematic component is made up by one parametric part and one non parametric part built by the sum of unknown “smoothing” functions of the covariates. For the estimators are used splines, functions made up by combination of little polynomial segment joined in knots.
  • 19. GAM Analysis Univariate Approach > library(mgcv) #stochastic risk premium with GAM approach# > PRSModgam1<-gam(RiskPremiumgam1~s(AgeCar, bs="cc", k=4) + +s(BodyCar, bs="cc", k=12)+s(VehValue, bs="cc", k=30) + +s(AgeDriver, bs="cc", k=6), weights=Exposure, data=rc, + family=Gamma(link=log)) > GAMSRiskPremium1<-predict(PRSModgam1,data=rc,type="response") Multivariate Approach > #stochastic risk premium with GAM approach# > PRSModgam2<gam(RiskPremiumgam2~te(BodyCar,VehValue,AgeDriver,AgeCar, + k=4),weights=Exposure, data=rc, family="Gamma"(link=log)) > GAMSRiskPremium2<-predict(PRSModgam2,data=rc,type="response") > rc$GAMSRiskPremium2<-with(rc, GAMSRiskPremium2)
  • 20. Mean commercial tariff Tariff requirement Loss Ratio Residuals degrees of freedom Expected Losses Actual Losses Explained Deviance Risk coefficients Uni- GLM 234,4587 1,000490 1,447822 27.501 9.337.547 9.342.125 96,96% 20 Variate GNM 234,4647 1,000476 1,447785 27.501 9.337.683 9.342.125 96,96% 20 Analysis GAM 232,8702 1,001729 1,457698 27.476 9.325.999 9.342.125 96,20% 45 Multi- GLM 234,6486 0,9981246 1,446650 27.505 9.359.678 9.342.125 87,64% 16 Variate GNM 234,6165 0,9979703 1,446848 27.505 9.361.125 9.342.125 87,04% 16 Analysis GAM 248,5732 0,8596438 1,365612 27.265 10.867.438 9.342.125 84,80% 256 Results
  • 21. GLM vs GAM vs GNM Approaches GLM GAM GNM Strengths: -User-friendly -Flexible to fit data -Afford some -Faster elaboration -Realistic values elaboration -Usually low level of excluded by GLM residual deviance -More risk coefficients -Better values despite GLM Weakness: -Poor flexibility -Complex to realize -Complex to use to fit data -Usually higher values of residual deviance -Overestimed values
  • 22. References  C.G. Giancaterino - GLM, GNM and GAM Approaches on MTPL Pricing - Journal of Mathematics and Statistical Science – 08/2016 http://www.ss-pub.org/journals/jmss/vol-2/vol-2-issue-8-august-2016/  X.Marechal & S. Mahy – Advanced Non Life Pricing – EAA Seminar  N. Savelli & G.P. Clemente – Lezioni di Matematica Attuariale delle Assicurazioni Danni – Educatt
  • 23. Many Thanks for your Attention!!! Contact: Claudio G. Giancaterino c.giancaterino@gmail.com