Fitting Yield Curves to rates

Link: https://juliaactuary.org/tutorials/yield-curve-fitting/

Graphic:

Excerpt:

Given rates and maturities, we can fit the yield curves with different techniques in Yields.jl.

Below, we specify that the rates should be interpreted as Continuously compounded zero rates:

using Yields

rates = Continuous.([0.01, 0.01, 0.03, 0.05, 0.07, 0.16, 0.35, 0.92, 1.40, 1.74, 2.31, 2.41] ./ 100)
mats = [1/12, 2/12, 3/12, 6/12, 1, 2, 3, 5, 7, 10, 20, 30]

Then fit the rates under four methods:

  • Nelson-Siegel
  • Nelson-Siegel-Svennson
  • Boostrapping with splines (the default Bootstrap option)
  • Bootstrapping with linear splines
ns =  Yields.Zero(NelsonSiegel(),                   rates,mats)
nss = Yields.Zero(NelsonSiegelSvensson(),           rates,mats)
b =   Yields.Zero(Bootstrap(),                      rates,mats)
bl =  Yields.Zero(Bootstrap(Yields.LinearSpline()), rates,mats)

That’s it! We’ve fit the rates using four different techniques. These can now be used in a variety of ways, such as calculating the present_valueduration, or convexity of different cashflows if you imported ActuaryUtilities.jl

Publication Date: 19 Jun 2022, accessed 22 Jun 2022

Publication Site: JuliaActuary

Getting Started with Julia for Actuaries

Link:https://www.soa.org/digital-publishing-platform/emerging-topics/getting-started-with-julia/

Graphic:

Excerpt:

Sensitivity testing is very common in actuarial workflows: essentially, it’s understanding the change in one variable in relation to another. In other words, the derivative!

Julia has unique capabilities where almost across the entire language and ecosystem, you can take the derivative of entire functions or scripts. For example, the following is real Julia code to automatically calculate the sensitivity of the ending account value with respect to the inputs:

When executing the code above, Julia isn’t just adding a small amount and calculating the finite difference. Differentiation is applied to entire programs through extensive use of basic derivatives and the chain rule. Automatic differentiation, has uses in optimization, machine learning, sensitivity testing, and risk analysis. You can read more about Julia’s autodiff ecosystem here.

Author(s): Alec Loudenback, FSA, MAAA; Dimitar Vanguelov

Publication Date: October 2021

Publication Site: SOA Digital, Emerging Topics

The Life Modeling Problem: A Comparison of Julia, Rust, Python, and R

Link: https://juliaactuary.org/blog/life-modeling-problem/

Graphic:

Excerpt:

All of the submissions and algorithms above worked, and fast enough that it gave an answer in very little time. And much of the time, the volume of data to process is small enough that it doesn’t matter.

But remember the CUNA Mutual example from above: Let’s say that CUNA’s runtime is already as fast as it can be, and index it to the fastest result in the benchmarks below. The difference between the fastest “couple of days” run and the slowest would be over 721 years. So it’s important to use tools and approaches that are performant for actuarial work.

So for little one-off tasks it doesn’t make a big difference what tool or algorthim is used. More often than not, your one-off calculatons or checks will be done fast enough that it’s not important to be picky. But if wanting to scale your work to a broader application within your company or the industry, I think it’s important to be perfromance-minded[4].

Author(s): Alec Loudenback

Publication Date: 16 May 2021

Publication Site: JuliaActuary

Julia for Actuaries

Link: https://juliaactuary.org/blog/julia-actuaries/

Excerpt:

Looking at other great tools like R and Python, it can be difficult to summarize a single reason to motivate a switch to Julia, but hopefully this article piqued an interest to try it for your next project.

That said, Julia shouldn’t be the only tool in your tool-kit. SQL will remain an important way to interact with databases. R and Python aren’t going anywhere in the short term and will always offer a different perspective on things!

In an earlier article, I talked about becoming a 10x Actuary which meant being proficient in the language of computers so that you could build and implement great things. In a large way, the choice of tools and paradigms shape your focus. Productivity is one aspect, expressiveness is another, speed one more. There are many reasons to think about what tools you use and trying out different ones is probably the best way to find what works best for you.

It is said that you cannot fully conceptualize something unless your language has a word for it. Similar to spoken language, you may find that breaking out of spreadsheet coordinates (and even a dataframe-centric view of the world) reveals different questions to ask and enables innovated ways to solve problems. In this way, you reward your intellect while building more meaningful and relevant models and analysis.

Author(s): Alec Loudenback

Publication Date: 9 July 2020

Publication Site: JuliaActuary