WARNING: In case a reader plans on using these notebooks as a reference to learning about QRM, I highly advise taking everything said with a grain of salt, as this is not my field of expertise and these notebooks are simply my notes on this course by Prof. Gregor Weiss from University of Leipzig.
Also, please see the "Unfinished Business" section towards the end. There are a few things that must be changed but due to time constraints, cannot be done immediately but rather slowly over time. If you can help, please do!
Very often in finance, a decision maker must consider the risk of every action. For example, an insurance business must price their premiums in accordance to the risk of various events, an asset manager must take into consideration their clients' risk tolerance, and a bank must have a model to determine (and ideally quantify) creditworthiness of potential debtors. This course is aimed at introducing the concept of quantitative risk, mostly in a market/banking context. Topics such as Stochastic Processes, Volatiltiy Forecasting, Mapping Risk Factors to Risk Measures are covered and implemented in Python. After this course, you will ideally be able to tackle questions such as "How do we define risk?", "How do we manage several non-deterministic factors?", "How can I build and backtest a volatility forecasting model?". Note that this course, at least in its current state, does not offer any advanced implementations to the methods described. Rather, all implementations act as proof-of-concepts that one could build sophisticated (sometimes industry level) models on top of. For this reason I have included a further reading folder filled with research papers, problem sets and advanced sources that one could look through if they find a specific topic particularly interesting/necessary.
These notebooks are designed for someone who has a background in statistics 101 and ideally knows a bit about stochastic processes. Furthermore, knowledge of several financial terms and concepts are assumed, although they're usually basic and could be learned by a quick google search. So, as you can see, there are very little pre-requisites and even those could be learned on the go (notebook 1 covers statistics 101, for example). The only thing I'd really insist on one knowing before reading this is Python. I try to make the code as simple as possible and comment on every line, but if you really want to build on top of this course I suggest having at least intermediate level skills.
The dependencies of the Python Implementations are:
pandas 1.5.0
numpy 1.22.0
matplotlib 3.6.0
scipy 1.6.0
arch 5.3.1
seaborn 0.12.0
This course consists of 8 lectures:
The title of this lecture might be misleading because whilst the content of this notebook shares a lot of content with intro stats courses, the manner and pace in which the content will be delivered assumes basic knowledge of the topic. A more appropriate title is "A Quick Brush up on Statistics In the Context of Finance".
The main topics of discussion are the following:
- Financial Data
- Financial Returns
- Statistical Variables
- Sample Statistics
- Two Dimensional Frequency Distributions
- Measures of Association
which should hopefully be a good start to the course.
The last lecture was focused on "introducing" the core concepts of inferential and descriptive statistics and overall how statistics could be used in finance. In the case of Risk Management, one is often concerned with modeling profit/loss data with various distributions and stochastic processes. This lecture will go through the most common families of statistical distributions and processes that one would encounter in Quantitative Risk Management.
The main topics of discussion are the following:
- Probability Distributions in
$\mathbb{R}^+$ and$\mathbb{R}^+_0$ - Multivariate Distributions
- Copulas
The previous section was concerned with probability distributions and stochastic processes. When introducing stochastic processes, I proposed a "coin game", which is a game where your friend goes on a 1D random walk according to a coin flip. If by the end of the walk they end up to the right of their initial position, they give you 5 dollars and if they end up to the left, you give them 5 dollars. Us being opportunist finance enthusiasts, we wanted to see if this game could be a valid investment by calculating the expected return (mean) and risk (standard deviation). The problem is that we did not have a formula for this stochastic process and therefore could not derive an expression for
The notebook will be divided into three parts:
- Motivation
- Inverse Transform Sampling
- Applications
Time series analysis is a very useful tool in financial engineering, especially when trying to extract a trend out of a stochastic process, calculate a smooth series (such as those "indicators" eg. SMA, EMA, etc), and forecast future developements of a time series. This notebook should hopefully cover all of these tasks and beyond.
The main topics of discussion are:
- Introduction to TSA
- Characteristics of time series
- Selected time series models
- Model Diagnostics
- Practical Example: Volatility Forecasting
Previously we covered time series analysis and how it can be used to perform techniques like volatility forecasting and modeling stocks prices. We will now shift towards describing the sources of risk, which is heavily dependent on the notion of a probability space.
The main topics of discussion are:
- Probability Spaces
- Fundamental Risk Factors
- Risk Mapping
The previous lecture covered risk mapping, which should output a loss distribution
The main topics of discussion are:
- Basics of risk measurement
- Axiomization of risk measure theory
- Important risk measures
- Standard techniques for calculating VaR
So far, we have learned how to take a series of risk factors, map them to a loss distribution and use that distribution to define various risk measures (most notably, VaR and CVaR). This lecture will cover how to control, that is to review and assess the quality of a risk models you are using by backtesting or stress testing. This is done with the goal of overall improvement.
The main topics of discussion are the following:
- Forecasting
- Backtesting
- VaR estimation: a practical example
Say you run an insurance business for high end vehicles. When pricing insurance premiums, you must not only take into account scratches and dents, but rather also one of your client's superyachts setting on fire. Here we will introduce extreme value theory (EVT), which is concerned with modeling events that are far from the mean of a probability distribution (e.g one of your client's superyachts setting on fire).
The main topics of discussion are the following:
- Introduction
- Block Maxima Method
- Threshold Exceedances
- Estimation of Risk based on Extreme Value Theory
This course is heavily based on the following resources:
[1] Weiss, Gregor. “Quantitative Risk Management", Leipzig University (Fall, 2021)
[2] McNeil, Alexander & Frey, Rüdiger & Embrechts, P.. (2015). Quantitative risk management: Concepts, techniques and tools: Revised edition. Quantitative Risk Management: Concepts, Techniques and Tools: Revised Edition. 1-699.
[3] Olofsson, Andersson. Probability, Statistics, and Stochastic Processes: Revised edition.
Unfinished Business:
- MLE + Regression + ML
- Finish Copula section
- Implement Univariate distribution fitting in some insurance math context
Implement ARCH and GARCH (and maybe even ARMA or GARCH-ARMA)- Do Bond Portfolio and Credit Portfolio + Python Implementation
- Monte Carlo Simulation to Calculate VaR
- Check if the multivariate normal dist is correct (probably isn't)
- Lecture 8