Book Image

Introduction to R for Quantitative Finance

By : Gergely Daróczi, Michael Puhle, Edina Berlinger (EURO), Daniel Daniel Havran, Kata Váradi, Agnes Vidovics-Dancs, Agnes Vidovics Dancs, Michael Phule, Zsolt Tulassay, Peter Csoka, Marton Michaletzky, Edina Berlinger (EURO), Varadi Kata
Book Image

Introduction to R for Quantitative Finance

By: Gergely Daróczi, Michael Puhle, Edina Berlinger (EURO), Daniel Daniel Havran, Kata Váradi, Agnes Vidovics-Dancs, Agnes Vidovics Dancs, Michael Phule, Zsolt Tulassay, Peter Csoka, Marton Michaletzky, Edina Berlinger (EURO), Varadi Kata

Overview of this book

Introduction to R for Quantitative Finance will show you how to solve real-world quantitative fi nance problems using the statistical computing language R. The book covers diverse topics ranging from time series analysis to fi nancial networks. Each chapter briefl y presents the theory behind specific concepts and deals with solving a diverse range of problems using R with the help of practical examples.This book will be your guide on how to use and master R in order to solve quantitative finance problems. This book covers the essentials of quantitative finance, taking you through a number of clear and practical examples in R that will not only help you to understand the theory, but how to effectively deal with your own real-life problems.Starting with time series analysis, you will also learn how to optimize portfolios and how asset pricing models work. The book then covers fixed income securities and derivatives such as credit risk management.
Table of Contents (17 chapters)
Introduction to R for Quantitative Finance
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Analysis of networks’ structure and detection of topology changes


Now, let us suppose we have access to a real-world database of an interbank market (randomized data for illustrative purpose), where banks lend to each other and lending banks report on their positions at the end of each day in the period of 2007-2010. The database consists of 50 banks and the maturity of the loans is one day. In order to manipulate the real-world networks in R, it is advisable to convert our data into a CSV file and save it into our working directory. The following table (Table 2) shows the top lines of our CSV file:

Bank

Partner

Amount

Interest

Year

Month

Day

1

21

5

7,9

2007

1

3

1

42

3

7,9

2007

1

3

10

11

0,35

7,8

2007

1

3

18

24

2

8

2007

1

3

2

11

1,3

7,8

2007

1

3

21

11

0,8

7,8

2007

1

3

21

2

5

7,75

2007

1

3

3

24

4

7,95

2007

1

3

Table 2: Database of an interbank market

Source: The authors

Each row contains a transaction: the reporting bank (the lender...