R Tutorial : Exploring other kinds of risk factors

Learn how to model risk factors across commodities and bonds beyond equities and forex. The tutorial covers zero-coupon bond pricing and yield curves, then explains why yields work better than raw prices as risk factors, plus the debate over log returns versus simple returns when rates are low or negative.
Chapters
I hope you are now getting the hang of how to explore risk factor time series. In particular, you should be comfortable with calculating log returns, which are the main kinds of data we model in market risk applications of quantitative risk management. And you should be comfortable with aggregating log returns by summing them to obtain longer interval log returns, for example aggregating daily log returns to obtain weekly, monthly and quarterly log returns. So far you have looked at equity data, both indexes and individual stocks, and you have looked at foreign exchange or FX data. To conclude the first chapter, you're going to look at two other kinds of data, commodities prices and zero coupon bond yields. First, commodities data Imagine you invest in gold or oil. How do the price risk factors for these commodities behave? Are they similar to stocks or are there differences? Now suppose you invest in fixed income securities like government bonds or Treasuries. The simplest kind of bond to analyze is called a zero coupon bond. This is a bond that pays a fixed amount at a future time known as the maturity, but which pays no intermediate interest income. Let PTT denote the price at times small t of a zero coupon bond paying one unit at time capital T. Capital T is the maturity of the bond that is the time at which the bond investor gets their money back. P010 is the price at time 0 of a bond maturing in 10 years or a 10 year bond. P0.5 is the price at time 0 of A 5 year bond. P510 is the price of a 10 year bond after 5 years. Rather than taking the price of the 0 coupon bond as a risk factor, it is quite common to take the risk factor to be the so called yield. The yield YTT is defined by the simple equation given on the slide. It's a measure of the rate of return per unit of time. YT10 gives the yield for an investor who buys a 10 year bond at time T. YT5 is the yield for an investor who buys A 5 year bond at time T. The main reason yields are preferred to prices is that they are comparable across different maturities T. You can directly compare the rates of return for investors who invest in 5 year bonds and 10 year bonds by comparing their yields YT5 and YT10. The set of yields y small T, big T for fixed small T and varying big T is known as the yield curve at times small T and is said to describe the term structure of interest rates. If you take the risk factors to be yields, there's a question about whether you should analyze log returns or simple returns of yields in a low interest rate environment and an environment where rates can become negative, there are arguments for using simple returns. So now you're going to try out some exercises on commodities and bond yields.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







