Book Image

Introduction to R for Quantitative Finance

Book Image

Introduction to R for Quantitative Finance

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

Model testing


The first tests on the beta-return relationship used two-phase linear regression (Lintner 1965). The first regression estimates the security characteristic line and beta of the individual securities as described above. In the second regression, the security's risk premium is the dependent variable, whereas beta is the explanatory variable. The null-hypothesis assumes the intercept to be zero and the slope of the curve to be the market risk premium, which is estimated as the average of the sample. The test can be extended by an additional explanatory variable: the individual variance.

Data collection

We will present the test using a sample of the US market in the pre-crisis period between 2003 and 2007. As daily data includes more short-term effects, we will apply the test on monthly returns calculated from the daily time series. So, we need the time series of the daily price of more stocks; let us download the prices of the first 100 stocks from S&P 500 in alphabetical order...