Welcome to DigitalActuary

DigitalActuary is the home page for heavymodel, a python based actuarial modelling library.

I have released heavymodel as open source software, for installation instructions and source code please see the installation page.

I can also be contacted via:

As heavymodel is currently in development, this documentation is incomplete in places, subject to change, and may have the occasional typo. Experimentation is encouraged, however please bear in mind the license conditions when using.

What is heavymodel?

heavymodel is a class-based library which enables Actuaries (and other modelling professionals) to build actuarial models in Python, using a function-based syntax similar to other actuarial modelling software, combined with the simplicity of writing code in python.

It is intended for prototyping models, and also implementing them within wider software releases, for example web-based quote engines, capital models, and optimisation models.

The core library places very few constraints on modellers, so is applicable to domains such as:

  • product pricing
  • deterministic valuations
  • stochastic modelling
  • nested models

It requires no additional libraries so can be used with recent Python distributions on any platform (Windows, Linux, Cloud).

Simple Example

The following code is for a simple persistency model, with policies decreasing 10% each year.

import pandas as pd
import seaborn as sns
sns.set()

from heavymodel import Model

class PersistencyModel(Model):
    def num_policies(self, t):
        if t == 0:
            return 1
        else:
            return self.num_policies(t-1) - self.num_lapses(t-1)

    def num_lapses(self, t):
        return 0.1 * self.num_policies(t)

model = PersistencyModel()

model._run(20)

df = pd.DataFrame({"num_lapses":model.num_lapses.values, "num_policies":model.num_policies.values})
sns.lineplot(data=df)

This produces the following graph.

simple example plot

For further details, please see the Getting Started section of the site.