Hostname: page-component-89b8bd64d-72crv Total loading time: 0 Render date: 2026-05-08T14:46:35.733Z Has data issue: false hasContentIssue false

Package CovRegpy: Regularized covariance regression and forecasting in Python

Published online by Cambridge University Press:  13 May 2024

Cole van Jaarsveldt*
Affiliation:
School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh, UK
Gareth W. Peters
Affiliation:
Department of Statistics & Applied Probability, University of California, Santa Barbara, CA, USA
Matthew Ames
Affiliation:
ResilientML, Melbourne, Australia
Mike Chantler
Affiliation:
School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh, UK
*
Corresponding author: Cole van Jaarsveldt; Email: cv25@hw.ac.uk
Rights & Permissions [Opens in a new window]

Abstract

This paper will outline the functionality available in the CovRegpy package which was written for actuarial practitioners, wealth managers, fund managers, and portfolio analysts in the language of Python 3.11. The objective is to develop a new class of covariance regression factor models for covariance forecasting, along with a library of portfolio allocation tools that integrate with this new covariance forecasting framework. The novelty is in two stages: the type of covariance regression model and factor extractions used to construct the covariates used in the covariance regression, along with a powerful portfolio allocation framework for dynamic multi-period asset investment management.

The major contributions of package CovRegpy can be found on the GitHub repository for this library in the scripts: CovRegpy.py, CovRegpy_DCC.py, CovRegpy_RPP.py, CovRegpy_SSA.py, CovRegpy_SSD.py, and CovRegpy_X11.py. These six scripts contain implementations of software features including multivariate covariance time series models based on the regularized covariance regression (RCR) framework, dynamic conditional correlation (DCC) framework, risk premia parity (RPP) weighting functions, singular spectrum analysis (SSA), singular spectrum decomposition (SSD), and X11 decomposition framework, respectively.

These techniques can be used sequentially or independently with other techniques to extract implicit factors to use them as covariates in the RCR framework to forecast covariance and correlation structures and finally apply portfolio weighting strategies based on the portfolio risk measures based on forecasted covariance assumptions. Explicit financial factors can be used in the covariance regression framework, implicit factors can be used in the traditional explicit market factor setting, and RPP techniques with long/short equity weighting strategies can be used in traditional covariance assumption frameworks.

We examine, herein, two real-world case studies for actuarial practitioners. The first of these is a modification (demonstrating the regularization of covariance regression) of the original example from Hoff & Niu ((2012). Statistica Sinica, 22(2), 729–753) which modeled the covariance and correlative relationship that exists between forced expiratory volume (FEV) and age and FEV and height. We examine this within the context of making probabilistic predictions about mortality rates in patients with chronic obstructive pulmonary disease.

The second case study is a more complete example using this package wherein we present a funded and unfunded UK pension example. The decomposition algorithm isolates high-, mid-, and low-frequency structures from FTSE 100 constituents over 20 years. These are used to forecast the forthcoming quarter’s covariance structure to weight the portfolio based on the RPP strategy. These fully funded pensions are compared against the performance of a fully unfunded pension using the FTSE 100 index performance as a proxy.

Information

Type
Actuarial Software
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2024. Published by Cambridge University Press on behalf of Institute and Faculty of Actuaries
Figure 0

Figure 1 Flow diagram summarizing stages (and providing the respective sub-packages within CovRegpy) of constructing leveraged risk premia parity portfolios using implicit factor models in a regularized covariance regression framework with either an $l$-lagged framework or a formal forecasting framework.

Figure 1

Figure 2 Additive synthetic time series described in Equations (2), (3), (4), and (5), used to demonstrate implicit factor extraction methods in this section which consists of a trend-cycle, seasonal, and irregular component.

Figure 2

Figure 3 X11 time series decomposition of synthetic additive time series into trend-cycle component, seasonal component, and random error or noise component.

Figure 3

Figure 4 SSA and D-SSA trend estimate and component isolation compared against the corresponding underlying structures.

Figure 4

Figure 5 Initialization of Gaussian functions, Equation (22), to be fitted to the PSD of the additive synthetic example presented in Fig. 2 for downsampling in SSD.

Figure 5

Figure 6 Fitting of Gaussian functions, Equation (22), to the PSD of the additive synthetic example presented in Fig. 2 for downsampling in SSD.

Figure 6

Figure 7 SSD of example time series using adjustable initial trend isolation window with the ubiquitous problem that also permeates EMD analysis known as the edge effect or frequency leakage between trend-cycle component and random error or irregular component.

Figure 7

Algorithm 1 Covariance Regression

Figure 8

Figure 8 Replication of Fig. 5 from (see p. 24, Hoff & Niu, 2012) plotting FEV data and variance in the left figure and height data and variance in the right figure as a function of age.

Figure 9

Figure 9 Replication of Fig. 6 from (see p. 25, Hoff & Niu, 2012) plotting FEV data and variance, height data and variance, and FEV and height data and correlation as a function of age.

Figure 10

Figure 10 Replication of Fig. 5 from (see p. 24, Hoff & Niu, 2012) plotting FEV data and variance in the left figure and height data and variance in the right figure as a function of age with RCR alternate estimate.

Figure 11

Figure 11 Replication of Fig. 6 from (see p. 25, Hoff & Niu, 2012) plotting FEV data and variance, height data and variance, and FEV and height data and correlation as a function of age with RCR alternate estimate.

Figure 12

Table 1. Summary statistics for quarterly returns of purely funded and unfunded pensions using the quarterly returns of the FTSE 100 as a proxy for unfunded pension schemes

Figure 13

Figure 12 Plot of the cumulative returns of funded and unfunded pensions from 1 April 2004 until 1 April 2023.

Figure 14

Table 2. Summary statistics for quarterly returns of hybrid pensions schemes using risk aversion level of $\gamma = 1.2$

Figure 15

Table 3. Summary statistics for quarterly returns of hybrid pensions schemes using risk aversion level of $\gamma = 1.4$

Figure 16

Table 4. Summary statistics for quarterly returns of hybrid pensions schemes using risk aversion level of $\gamma = 1.6$

Supplementary material: File

van Jaarsveldt et al. supplementary material 1

van Jaarsveldt et al. supplementary material
Download van Jaarsveldt et al. supplementary material 1(File)
File 1.8 MB
Supplementary material: File

van Jaarsveldt et al. supplementary material 2

van Jaarsveldt et al. supplementary material
Download van Jaarsveldt et al. supplementary material 2(File)
File 16.5 KB
Supplementary material: File

van Jaarsveldt et al. supplementary material 3

van Jaarsveldt et al. supplementary material
Download van Jaarsveldt et al. supplementary material 3(File)
File 16.8 KB
Supplementary material: File

van Jaarsveldt et al. supplementary material 4

van Jaarsveldt et al. supplementary material
Download van Jaarsveldt et al. supplementary material 4(File)
File 19 KB