Rscripts, Algorithms and Slides
Over the course of many research projects, I have created a variety of Rscripts (computer code) and related algorithms that I have made available for download from this webpage. I also use this material for teaching my advanced course on Retirement Income Models and you are free to download and use them and the associated lecture slides included in the zip files.

FINE4060 slides and scripts for lecture #1
Download a zipped file which includes the PDF slides used in lecture #1, where I introduced the types of problems we will solve in the course, instructions on how to download and install Rstudio together with some basic Rscripts.

FINE4060 slides, scripts and data for lecture #2
Download a zipped file which includes a (hypothetical) personal finance dataset in csv format, a number of Rscripts and the PDF slides used for lecture #2, in which we codeup a basic model of spending and saving over the lifecycle and compare with the data.

FINE4060 slides and scripts for lecture #3
Download a zipped file which includes a number of Rscripts and the PDF slides used for lecture #3, in which we discuss how to model and measure the longevity of a portfolio subject to withdrawals, basic Monte Carlo (MC) simulations and the sequence of returns (SoR) effect.

FINE4060 slides, plot scripts and data for lecture #4
Download a zipped file which includes a number of plot Rscripts, data files and the PDF slides used for lecture #4, in which we introduce and discuss basic cohort mortality tables, the implied mortality rates and the concept of a random remaining lifetime, all in discrete time. And, some financial economics at the very end.

FINE4060 slides and scripts for lecture #5
Download a zipped file which includes a number of Rscripts, data files and the PDF slides used for lecture #5, in which we discuss period vs. cohort mortality tables, the GompertzMakeham law of mortality, estimating parameters via regression, projection factors and reduction scales, the Compensation Law of Mortality (CLaM), simulating random lifetimes and a brief discussion of biological versus chronological age.

FINE4060 slides and scripts for lecture #6
Download a zipped file which includes a number of Rscripts, data files and the PDF slides used for lecture #6, in which discuss the lumpsum versus pension annuity dilemma, the valuation of life annuities under the Gompertz law of mortality, the general valuation of longevitycontingent claims via the Binomial distribution, the Law of Large Numbers and finally, we locate some mortality credits.

FINE4060 slides and scripts for lecture #7
Download a zipped folder which includes the PDF slides used for lecture #7, in which I discuss modeling Defined Benefit (DB) versus Defined Contribution (DC) pensions, codingup Monte Carlo simulation of DC account values at retirement in R, discussion of typical DB benefit formulas and whether or not to delay your pension (e.g. CPP or OAS) in exchange for higher benefits in the future, all under idealized conditions.

FINE4060 slides and scripts for lecture #8
Download a zipped folder which includes PDF slides and Rscripts used for lecture #8, in which I discuss and solve the (FisherYaari) retirement lifecycle model (LCM) with Gompertz mortality, the optimal consumption spending rate, and the wealth depletion time (WDT) in the presence of pension income.

FINE4060 Homework Assignment and Projects (FINAL)
Download a zipped folder which contains all the homework assignment questions with the final project used in the Winter 2019 semester plus an advanced reading list. The folder also contains a complete collection of all the Rscripts with a few extra ones I have used in some recent technical papers, all in one centralized location. (Note there are only 8 weeks of formal lecture notes. The other sessions were used to solve problems and for guest lectures.)
By downloading these files the user understands and agrees that Moshe Milevsky makes no representations or warranties whatsoever regarding the products, developments, documentation, or any other materials or services provided hereunder, and specifically disclaims any and all other warranties, whether expressed or implied.