Skip to content

Instantly share code, notes, and snippets.


Silvana Pesenti spesenti

View GitHub Profile

A portfolio example

Here, through an example, we illustrate the basic concepts and usage of SWIM for sensitivity analysis. More advanced usage of SWIM and options for constructing stresses are demonstrated in the vignette Vignette.html.

We consider a simple portfolio model, with the portfolio loss defined by Y = Z1 + Z2 + Z3. The random variables Z1, Z2, Z3 represent normally distributed losses, where Z1 has mean 100 and standard deviation 40, and Z2 and Z3 have mean 100 and standard deviation 2. Further, Z1 and Z2 are correlated, while Z3 is independent of (Z1, Z2). Our purpose in this example is to investigate how a stress on the loss Z1 impacts on the overall portfolio loss Y. First we derive simulated data from the random vector (Z1, Z2, Z3, Y), f