Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Introduction to R for Quantitative Finance

You're reading from   Introduction to R for Quantitative Finance R is a statistical computing language that's ideal for answering quantitative finance questions. This book gives you both theory and practice, all in clear language with stacks of real-world examples. Ideal for R beginners or expert alike.

Arrow left icon
Product type Paperback
Published in Nov 2013
Publisher Packt
ISBN-13 9781783280933
Length 164 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (17) Chapters Close

Introduction to R for Quantitative Finance
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Time Series Analysis FREE CHAPTER 2. Portfolio Optimization 3. Asset Pricing Models 4. Fixed Income Securities 5. Estimating the Term Structure of Interest Rates 6. Derivatives Pricing 7. Credit Risk Management 8. Extreme Value Theory 9. Financial Networks References Index

Migration matrices


Credit rating transition is the migration of a corporate or governmental bond from one rating to another. The well-known industrial application is the CreditMetrics approach. It provides a risk modeling tool for bond portfolios to estimate the Conditional Value-at-Risk (CVaR) and credit spreads of a portfolio due to downgrade and upgrading. In this section, we show how to calculate credit spreads from a transition matrix.

We have to define the loss given default (lgd), the ratings (in this example: A, B, and D) and the one year transition matrix to compute credit spreads:

> library(CreditMetrics)
> lgd <- 0.5
> rc <- c( "A", "B", "D")
> M <- matrix(c(85, 13, 2, 5, 80, 15, 0, 0, 100 ) /100, 3, 3,
+          dimnames = list(rc, rc), byrow = TRUE)

The command cm.cs calculates the credit spreads from the migration matrix:

> cm.cs(M, lgd)
         A          B
0.01005034 0.07796154

According to this example, a debt instrument with the rating "A" has around...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime