Slides amsterdam-2013

7,878 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,878
On SlideShare
0
From Embeds
0
Number of Embeds
1,273
Actions
Shares
0
Downloads
33
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Slides amsterdam-2013

  1. 1. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 in Actuarial Science a brief overview Arthur Charpentier charpentier.arthur@uqam.ca http ://freakonometrics.hypotheses.org/ January 2013, Universiteit van Amsterdam 1
  2. 2. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Agenda• Introduction to R• Why R in actuarial science ?◦ Actuarial science ?◦ A vector-based language◦ A large number of packages and libraries for predictive models◦ Working with (large) databases in R◦ A language to plot graphs• Reproducibility issues• Comparing R with other statistical softwares◦ R in the insurance industry and amongst statistical researchers◦ R versus MsExcel Matlab, SAS, SPSS, etc◦ The R community• Conclusion ( ?) 2
  3. 3. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 R“R (and S) is the ‘lingua franca’ of data analysis andstatistical computing, used in academia, climate research,computer science, bioinformatics, pharmaceutical industry,customer analytics, data mining, finance and by someinsurers. Apart from being stable, fast, always up-to-dateand very versatile, the chief advantage of R is that it isavailable to everyone free of charge. It has extensive andpowerful graphics abilities, and is developing rapidly, beingthe statistical tool of choice in many academic environments.” 3
  4. 4. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 A brief history of RR is based on the S statistical programming language developed by JoeChambers at Bell labs in the 80’sR is an open-source implementation of the S language, developed by RobertGentlemn and Ross Ihaka 4
  5. 5. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 actuarial science ? • students in actuarial programs • researchers in actuarial science • actuaries in insurance companies (or consulting firms, or financial institutions, etc)Difficult to find a language/software interestingfor everyone... 5
  6. 6. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Using a vector-based language for life contingenciesA life table is a vector > TD[39:52,] > TV[39:52,] Age Lx Age Lx 39 38 95237 38 97753 40 39 94997 39 97648 41 40 94746 40 97534 42 41 94476 41 97413 43 42 94182 42 97282 44 43 93868 43 97138 45 44 93515 44 96981 46 45 93133 45 96810 47 46 92727 46 96622 48 47 92295 47 96424 49 48 91833 48 96218 50 49 91332 49 95995 51 50 90778 50 95752 52 51 90171 51 95488 6
  7. 7. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Using a vector-based language for life contingenciesIf age x ∈ N∗ , define P = [k px ], and p[k,x] corresponds to k px .The (curtate) expectation of life defined as ∞ ∞ ex = E(Kx ) = k · k|1 qx = k px k=1 k=1and we can compute e = [ex ] using> life.exp = function(x){sum(p[1:nrow(p),x])}> e = Vectorize(life.exp)(1:m)The expected present value (or actuarial value) of a temporary life annuity-due is n−1 1 − Ax:n ax:n = ¨ ν k · k px = 1−ν k=0 7
  8. 8. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Using a vector-based language for life contingenciesand we can define A = [¨x:n ] as a> for(j in 1:(m-1)){ adot[,j]<-cumsum(1/(1+i)^(0:(m-1))*c(1,p[1:(m-1),j])) }Define similarly the expected present value of a term insurance n−1 A1 = x:n ν k+1 · k| qx k=0and the associated matrix A = [A1 ] as x:n> for(j in 1:(m-1)){ A[,j]<-cumsum(1/(1+i)^(1:m)*d[,j]) }Remark : See also Giorgio Alfredo Spedicatos lifecontingencies package, andfunctions pxt, Axn, Exn, etc. 8
  9. 9. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Using a matrix-based language for prospective life modelsLife table L = [Lx ] is no longer a matrix (function of age x) but a matrixL = [Lx,t ] function of the date t.> t(DTF)[1:10,1:10] 1899 1900 1901 1902 1903 1904 1905 1906 1907 19080 64039 61635 56421 53321 52573 54947 50720 53734 47255 469971 12119 11293 10293 10616 10251 10514 9340 10262 10104 95172 6983 6091 5853 5734 5673 5494 5028 5232 4477 40943 4329 3953 3748 3654 3382 3283 3294 3262 2912 27214 3220 3063 2936 2710 2500 2360 2381 2505 2213 20785 2284 2149 2172 2020 1932 1770 1788 1782 1789 17516 1834 1836 1761 1651 1664 1433 1448 1517 1428 13287 1475 1534 1493 1420 1353 1228 1259 1250 1204 11088 1353 1358 1255 1229 1251 1169 1132 1134 1083 9619 1175 1225 1154 1008 1089 981 1027 1025 957 885Similarly, define the force of mortality matrix µ = [µx,t ] 9
  10. 10. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 10
  11. 11. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Using a matrix-based language for prospective life modelsAssume - as in Lee & Carter (1992) model - that log µx,t = αx + βx · κt + εx,t ,with some i.i.d. noise εx,t .Package demography can be used to fit a Lee-Carter model,> library(demography)> MUH =matrix(DEATH$Male/EXPOSURE$Male,nL,nC)> POPH=matrix(EXPOSURE$Male,nL,nC)> BASEH <- demogdata(data=MUH, pop=POPH, ages=AGE, years=YEAR, type="mortality",+ label="France", name="Hommes", lambda=1)> RES=residuals(LCH,"pearson") 11
  12. 12. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Residuals in Lee & Carter model q q 1.5 2000 qq qq q 1990 qqq q qq q qqq q qqqqqqq q 1.0 qq q q qqqqq qqq q qqqqqq qqqqqqq q qqq qqq qq q q q qq q qqqqq qqqqqqqqq q 1980 q qqqq qqqqqqqqq q q qq q q q q q qqqqq q qq qqqqq qq qqqqqqqqqqqqqqqqq q q qqqqqqqq qqqq q qq q q qq qqqqqqqq qqqqqqq q qq q qq qq q q qqqqqqqqqqqqqq qqqq q q q q qq qqqq q qqqq q q qqqqqqqqqqqqqqqqq qqqqqqqqq qqqqqqqqqqq qq qqqqqqq qqq q q q qq qq q q q q q q q qqqqqqqqqq qqqqqq qqqqq q q qqqqqqqq qq q q 1970 q 0.5 q q qq qq qqq qqqqqqq qq q qqqq q qqqqq qqq q q qqqqqqq qqqqqqq qq qqqqqqqq q qq qqq qqqqqqq q q q qqqqqq q q qq q q q qqq q qqqqqqq qq q qqq q qqq qqqqqqqqqqqq q q qqq qq q q q qqq qqqqqqqqqqqqqq q qq qqq qqq qqq qqq qqqqqqqqqqqq qqqq qqqq q qqqqq Residuals (Pearson) q qqqqqqqqqq qqqqqqqq qqq q q qqqqq qq qq q q qq q qq qqq qq q q qqq q q qqqqq qq qq qqqqqqqqqqqqqq q qq qqq qqqq q qqqqqqq q q q qqq q q qqqqqqqqqqq q qqqqq q qqqqqqqqq qqqq qqqq qq qqqqqq q 1960 qqqq q q qq qqq qq q q qq qqqqqqqqqqqqqqqqqqqqqqqqq q qq qqq qqqqq qqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqq qq qqqqq qq qq q q qqqq qqqqqqqqq qqqq q qq qq qqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqq q q qqq qqqq qq q q q qqqq q q qqqqqq qqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq q q qqqqqqqqqqqqqqqqqqq q q qqqqqq qqqqqqqqqqqq qqq qqqqqqqqqq q qq q qqqq qqqqq qqq q q q qqq q q qq qqq qqq q qqqqqqqqqq q qqqq qqqqqqqqqqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qq q qqqq qqqqqqqqqqqqqq qqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqq qq qq qqqq qqqqqq q qqqqqqqqqqqqqqqqqqqqq qqqq qq qqqqqqqqqq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q q qqqqqqqq qqqqqqqqqq q qqqqqqqqqq qqqqqqqqqqqqqqq q q qq qq qqqq qqqqqqqq qqqqqqqqq qqq qqqqqq qqqqqqq qqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqq qqq qq qq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq q q q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qq qqq qqqq qq q q q qqqq qqqq qqqqq qqqqqqqqqqqqqqqqqqq qq q qq q q qq qqq qqqqqq qqqqqqqqqqqqqqqqqqqqq qq qqqqqqq qqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqq q qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qq qq qqqqq qqqqqq qqqqqqqqqqqqqqq qq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qq qq q qq 0.0 qq qqqqqqq qqq qqq q qqqqqqqqqqqqqqqqqqq q qq q qq q q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqq qqqqqqqq q qq qqqqqqqqq qqqqqq qqq q qqq qqqqqqqqqqqq qqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqq qqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q 1950 q qqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqq q q qqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq qq qqqqqqqqqq q qq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqqq qqqqqqq qqqqqqqqq qqqq qqqqqqqqq qqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqq qq qqq qqqqqqqqq qqq qq qqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqq qqq qqq qqqqqqq qq qqqqqqqqqqqqqqqq qq qqqqqqqqqqqqqqqqqqq qqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq qqqqq q qq q qq q qqqqq qq qqq q qq qqqqqqqqqqq q qqq qqqq qqqqqqqqq qq qq qq q q qq q qqqq qq q qqqqqq qqqqqqq qqqq q q qqqqq qq qqqqqqqqqqqq qq q q qqq qqqqq qqqqq qqqqq qq qq qq qqqqqqq q qq q qqqq qqqq q q qq qqqqqqqqqqqq qqq qqq qqqqqqqqqqqqqq qqqqq qqqqqqqqqqqqqqqq qqqqq qqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q q qq q qqq q q qq qqqqqqqq qq qq qqqqqqqqqqqqqqqqq q qqqqqqqqqqqqqqqqqq q qq qq q q q qq q q qqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqq q qqqqqqqqqq q qq q q qqqqqqqqq q qq qqqqq qq q qq q qqqqq q qq q qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqq qqq qqqqqqqqqq q qqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqq qqqq qqqq q q qqqqq qqqqq qqq qq q q qq qqqq qq qqqqqq qq qq q q qqqqqqqqqqq qqqqqqqqqqqqqq qqqqqqq q qqqqqqqqqqqqqqqqq qqqqqqq q qq qq qqq qqq qq qq q qqqqqqqqqq qqqqqqqqqqq q q qqqq qqqqq q qq q q qq qq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqq qqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqq qqqqqqqqqq qqq qqqq qq qq qqqqqq q q q q qqqq qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq qqq qqq qqqqqq qq qqqq qqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqq q q q qqq qqqqqqqqqqq qq qq q qqq q qqqq qq q qq q qqq q q q q q q q qq qqqqqqqq q qq qqqqqqqqqqqqqqqqq q qq qq qq q qq qqqq qqqqqqq q qq q qq qqqqqq qq q qqqq 1940 qqqqqqqqq qqqqq qqqqqqqqqqqqqqqqqqqqqqqqqq qq qq q qq qq q qq qqqqqq qq qqq qq qqq qqqqqqq qqq q qqqq qqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqq qq qqqq q qqq q q q qq q qq qqqq qqqqqqqqqqqq qq qqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq qqqqq qq qqq q q qqq qq −0.5 qq qqqq q qqqqq q q q qqqqqqqqqqqqqqq qqqqqqqqqqqqqqqq qqqq q qq qq q q q qq qqq q qqq qqq qqq q q qq qqqqqq q qq q qq qq q q qq qqqq qq qqqqqqqqq qq q q q q q q qq qq q qqqqq qqqqqqqqqq q q qqqqq qqqqqqq qqq qqq q qq q qq qqqqqqqq q qq q qq q q q q qq qqq qqqq qqqq qqqq q q q qq q 1930 q q qqq q qqqqqqqqqq qqq qqqq q q q q q q q q q qq q q q qq qqqqq qqqqq q qq qq q qq q qqq q q q q q q qq q q qq q 1920 q qq −1.0 q qq q qq q q qqq qq q q q q q q qq q 1910 q q q q q −1.5 1900 0 20 40 60 80 100 120 Age 12
  13. 13. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Residuals in Lee & Carter model 110 q q 1.5 100 q q qq q 90 qqq qq q qqq qqq q q qq 1.0 q q q qqq q qq qq qqq qqqqq q qq q qqq q q q q qq q 80 q qqqqq q qq q qq qq q qqq q qqqqq qqqqq q qqq q q qqq qqqqqqqq qqqq q qq q qqqq qqq qq q qq qqqqqqqqqqqqqq qq qqqq qqq q q q qqq qqqqqqqq qqqqqqqqqqqqqqq q qq q qqqq q qqq qqq q qqq qqqqqqqqqqqqqqqq q q q q q q qqqqqqqqqqqqqqqq qq qqq q q q 70 q q q q q q qqqq qqqqqqqqqqqq q q qqq q q q q 0.5 q qqq qq q q q qq qqqq qqqqqqqqqqqq q q q q q q q q qq q q q qqqq qqqqqqqqq qqq q q qqq qqqqq q q q q qqq q qq q qqqqqqqqqqqqqqqqqq qq q qqqq qqq qq qqqqqqqq q q q qq qq q qqqqqq qqqqqqqqqqqq Residuals (Pearson) qqqqqqq qq qqqq q qq q q q q q q qqq q qq qqqqqqq qqqq q q q qqq q q q q q q qqq q q qqqqqqq qqqqqqqqqqq qq q q qqqqqqqqqqqqqqqqqqqq q q q qqqqq qqq q q qq q q q q qqqqq qq q qq q q q qqqqq qqqqqqqqqqqqqqqqqqqq 60 qqqqqqqq qqq qqqqq qqqqqq q q qq q q q q qqqq qq qqqq qqqq qq qqqqqqqqqqqqq qq q q qqqqqqqqqqq qqqq q qq q q qqq q qqqq qqq qqq q q q qq qqqqqqq q q q q qqqqq qqqqqqqqqqqqqqqqqqqqqqq q q q qqq qqq q qq q qq qq qq q qq qqq qq q qqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqq q q q qqq q qq qqqqqqqq qqq qq q qqq q q q q q q q qqq qqqqqqqqqqqqqqqqqqq qqq q qqqqqq q qqq qq q q q qq q qqq q q qqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqq qqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqq q q qq q q q q qq qqqqqq qqqqqqqqq qqq qq q qqq q qq q q qq q qqq qqq qqq q qq qqqq q qqqq q qqq q qqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q q qqqqqqqq qq qq qqqqqqqq qqqqqqqqqq q qq q q q q q q qq q qq q qqq qqqqqqq qqq q q qqqqqqq q qq q q qqq q qqqqqqqqqqqqqqq qqqqq q qqqqqqqqq q q qq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq q q q q 0.0 qqq q q q qq qqqq q qqqq qqqqq q qqq qq q q q qqq qqqqqqqqqq qqqqq qq q qqqqqqqqqqqqqqq q q qq qqqqqqqq q qqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq q q q q qqq q qqqq q q q 50 qqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqq q q qq qqqqqqqq qqqqqq q q q qq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqq qqq qqq q qqqqqqqqqq q qqq q qq qqqqqqqqqqqqqqqqqqqqqqqq q qqqqqq qqq qqqqq qqqqqqqqqq qqqqqq qqqqqqq qqqq q q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq qqq qqq qqq qq q q qq q qqq q q qqqq q qqqqqqq qq q q q q q q q qqqqqqqq q qqqqqqqq qqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqq qq q q q qqqq qqqq q qqqq q qq qq qq qq q q qqq qqq qqqqqqqqq q q q qq qq qqqqqqqqqqq qqqqqqqq q q qqqqqqqqqqqqqqqq q q qq q qq q q q qqqqq q q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqq q q qq qqqqq qq q q q q q q q q q q q qqqq q q qqqqqqqqq qq q qqqq qq qqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqq q q qqqqqqqqq qqqqqqq qq qqqqqq q q qq q q q q qqqqqqqqqq qqqqqqqqqqqqqqqqqqqq qq q q q qq qqqqqq qq q q q q q qqq q q q qqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qq qq q qqq q qqq qqq qqq qq q q q q q qqqqqqqqqqqqqqqqqqqq q qqq qqqqqq qqqqq qq qqqqqqqqqqqqqq q q q qqqqq q q qqq qqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqq q qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq q qqqq q qqq qqqq q qq qqq 40 q q q qqqqqqqqqqqqq qqqq qq qqq q q qq qq qqqqqqqqq qq q q q q qqq qqqqq qq qqqqqqqqqqqqqqqqqqqqqqq qqqq q q q q q q qq qqqqqqqq qq q qq qq qq qqqqqqq qqqqqqqqqqqqqqq qq q q q q q qq qq qqq q qqq qq q q q q q q q q qqq qqq q qq qqqqqqq qq q qq q qqqqqqqqqqqqqqqqqq qq q q q qq qqqqq qq q q q q q q q qq q q qq q q qqq qqqq qqqqqqqqqqqqqqqqqq qqq qqqqqqqq qq qq qqqqq q q q −0.5 q q q q q qq q q qqqqqqqqqqq qq q q qq q q q q q q qqq q q qqqqqq q qqqq q q q q q q q q q qq q q q q qqqqqqqqqq q qq q qqq qq qq qq qq q q qqqqqqq q qqq qqqqqqqq qqqq q qq q qqqqqq q q q q q qqqqqqqq qq qq q qq q q q q q q q qqqqqqqq q q qq q 30 q q qqqq q q qq q q qqqqq q q q qqqqqq q q q qqq q qqq q q qqqqq q q qqq q q q q q q q q q q q qq qqq q qq q q q q q 20 qqq q −1.0 q qqqq q q q q q q qqq q q q q q qq q 10 q q qq −1.5 0 1900 1920 1940 1960 1980 2000 2020 Year 13
  14. 14. Arthur CHARPENTIER - R in Actuarial Science - UvA actuarial seminar, January 2013 Using a matrix-based language for prospective life modelsOne can consider more advanced functions to study mortality, e.g. bagplots, sinceµx,t is a functional time series,> library(rainbow)> MUH=fts(x = AGE[1:90], y = log(MUH), xname = "Age",yname = "Log Mortality Rate")> fboxplot(data = MUHF, plot.type = "functional", type = "bag")> fboxplot(data = MUHF, plot.type = "bivariate", type = "bag")Source : http ://robjhyndman.com/ 14

×