1 Introduction

1.1 Background and contribution

Complex quantitative models are used extensively in actuarial and financial risk management applications, as well as in wider fields such as environmental risk modelling (Tsanakas and Millossovich 2016; Borgonovo and Plischke 2016; Pesenti, Millossovich, and Tsanakas 2019). The complexity of such models (high dimensionality of inputs; non-linear relationships) motivates the performance of sensitivity analyses, with the aim of providing insight into the ways that model inputs interact and impact upon the model output.

When model inputs are subject to uncertainty, global sensitivity methods are often used, considering the full space of (randomly generated) multivariate scenarios, which represent possible configurations of the model input vector. The particular task of ranking the importance of different model inputs leads to the use of sensitivity measures, which assign a score to each model input. A rich literature on global sensitivity analysis exists, with variance decomposition methods being particularly prominent; see Saltelli et al. (2008) and Borgonovo and Plischke (2016) for wide-ranging reviews. The R package sensitivity (Iooss, Janon, and Pujol 2019) implements a wide range of sensitivity analysis approaches and measures.

We introduce an alternative approach to sensitivity analysis called Scenario Weights for Importance Measurement (SWIM) and present the R package implementing it (Pesenti et al. 2020). The aim of this paper is to provide an accessible introduction to the concepts underlying SWIM and a vignette demonstrating how the package is used. SWIM quantifies how distorting a particular model component (which could be a model input, output, or an intermediate quantity) impacts all other model components. The SWIM approach can be summarised as follows:

1. The starting point is a table of simulated scenarios, each column containing realisations of a different model component. This table forms the baseline model as well as the dataset on which the SWIM bases its calculations.

2. A stress is defined as a particular modification of a model component (or group of components). This could relate to a change in moments, probabilities of events of interest, or risk measures, such as Value-at-Risk or Expected Shortfall (e.g. McNeil, Frey, and Embrechts (2015)).

3. SWIM calculates a set of scenario weights, acting upon the simulated scenarios and thus modifying the relative probabilities of scenarios occurring. Scenario weights are derived such that the defined stress on model components is fulfilled, while keeping the distortion to the baseline model to a minimum, as quantified by the Kullback-Leibler divergence (relative entropy).

4. Given the calculated scenario weights, the impact of the stress on the distributions of all model components is worked out and sensitivity measures, useful for ranking model components, are evaluated.

A key benefit of SWIM are that it provides a sensitivity analysis framework that is economical both computationally and in terms of the information needed to perform the analysis. Specifically, sensitivity analysis is performed using only one set of simulated scenarios. No further simulations are needed, thus eliminating the need for repeated evaluation of the model, which could be numerically expensive. Furthermore, the user of SWIM needs to know neither the explicit form of the joint distribution of model components nor the exact form of functional relations between them. Hence, SWIM is appropriate for the analysis of black box models, thus having a wide scope of applications.

The SWIM approach is largely based on Pesenti, Millossovich, and Tsanakas (2019) and uses theoretical results on risk measures and sensitivity measures developed in that paper. An early sensitivity analysis approach based on scenario weighting was proposed by Beckman and McKay (1987). The Kullback-Leibler divergence has been used extensively in the financial risk management literature – papers that are conceptually close to SWIM include Weber (2007); Breuer and Csiszár (2013); and Cambou and Filipović (2017). Some foundational results related to the minimisation of the Kullback-Leibler divergence are provided in Csiszár (1975).

1.2 Installation

The SWIM package can be installed from CRAN or through GitHub:

# directly from CRAN
install.packages("SWIM")
# and the development version from GitHub
devtools::install_github("spesenti/SWIM")

1.3 Structure of the paper

Section 2 provides an introduction to SWIM, illustrating key concepts and basic functionalities of the package on a simple example. Section 3 contains technical background on the optimisations that underlay the SWIM package implementation. Furthermore, Section 3 includes a brief reference guide, providing an overview of implemented R functions, objects, and graphical/analysis tools. Finally, a detailed case study of a credit risk portfolio is presented in Section 4. Through this case study, advanced capabilities of SWIM for sensitivity analysis are demonstrated.

1. Correspondence to Silvana Pesenti, Department of Statistical Sciences, University of Toronto, Canada.