The misson of Rmodel.io website is to create and promote an open-source software framework for life insurance actuarial modeling using R programming language.
Actuaries heavily rely on models for their day-to-day work. Life insurance actuaries use models to calculate policy liabilities, make financial projections, and develop premium rates for new products.
R has gained popularity among actuaries in data analytics and visualization in recent years. Some actuaries are already familiar with R. R is also a a perfect tool for building complex actuarial models. Here is why:
Why R for Actuarial Modeling?
Most formulae in actuarial models can be expressed in algebraic equations consisting of vectors in which each element represents the value at every point in time.
In dealing with vector calculations, most programming languages will require codes that contain a loop to perform calculation on the vectors’ elements one by one. This is different for R.
Vector is really the most basic data structure in R. Fundamentally, every piece of information is represented and handled as a vector. Most statements and functions are expressed and performed over the entire vectors. It is called “vectorized operation” in R. It is highly encouraged to vectorized your codes as much as possible. This not only makes the statements look more like a math equation that you would write on piece of paper but also improve the execution efficiency.
In R, the objectives of code succinctness, readability and computing efficiency are perfectly aligned.
Like many other modern programming languages, R offers objected-oriented programming (OOP) feature. In actuarial modeling, every product, policy, actuarial table or assumption can be treated as an object. In OOP terms, each object is an instance of a certain class. A class can inherit from another class in the way that the characteristics of the parent can be preserved while the child can also have its own distinct features. If we can design classes properly, we are able to save a lot of code creation and maintenance, and ensure business logic is coherent throughout the modeling work.
Here is a simplified example of how OOP feature can be applied to actuarial modeling. Suppose you have a class defined for a 20-year level term product. Let’s call it T20. T20 has level premiums payable throughout the coverage period. It pays a death benefit equal to face amount in case of insured’s death during the coverage period. If you have a new product (called T20ROP) that is the same as existing T20 in most ways except that 25% of premium will be refunded in case the insured survives the end of coverage period. When you model this new product, you do not have to start from scratch. You can “inherit” T20ROP from T20. All codes written for T20 will be passed down to T20ROP. You only need to add codes to model the business logic for refund of premium feature.
Parallel Computing Capability
It is not uncommon that some actuarial models need to process a very large amount of data or execute a long and complicated series of calculation. Therefore, computing speed, or run time, will be important.
Modern computers always come with a CPU (or multiple CPUs) with multiple cores that enables parallel processing. The ability to make use of the technology will reduce model run time tremendously.
With R, you do not need to be a professional programmer in order to harness the power of parallel computing. You, as an actuary, can implement parallel processing with simple codes when running your models. You can even decide how many cores that you want to assign to the modeling job because you may need to reserve some computing power for other background tasks. This is made possible by several available parallel processing R packages that you can download and install in your R environment.
Actuaries who would like to expand technical skills shall learn R programming language. R is a versatile tool that can be applied to many fields. Learning and applying the language now will also benefit an actuary’s career in the future.
Since its initial release during 1990s, R has been widely used among statistician and data scientists for statistical analysis and data mining. Because it is distributed under an open source license, it has a worldwide user community. The number of packages that enhance the functionality or expand application areas is also increasing rapidly. Nowadays R is a major tool for emerging fields including predictive modeling, machine learning and big data analytics. Some actuaries use it to analyze and predict health insurance claims and life insurance policyholder behaviors. The influence of R is ever increasing, so is the potential benefit of learning it.
R has many strengths that make it an ideal language tool for building complex actuarial models. Many actuaries are already famililar with R and apply it for actuarial work. It is natural to expand its application area to life insurance modeling. However, from a community perspective, it is still not efficient that every individual actuary needs to reinvent the wheel and create a model from the ground up.
Rgogo is an open-source software framework that harnesses the strengths of R and provides actuaries efficiency in building complex models. The framework comprises a collection of building blocks and tools that allow an actuary to build a complex model easily and quickly.