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

Beta estimation


The sensitivity of a security towards a factor can be estimated from past price movements. We will estimate the beta from the one-factor index model. First, we show the process of collecting and synchronizing data from different sources and then present the simple beta estimation method and, at last, a linear regression model is built.

Data selection

We download the time series of the price of a given stock, for example Google, and the time series of the price of the market index, the S&P 500, from June 1st 2009 to June 1st 2013 from Quandl, as discussed in the second chapter:

> library(Quandl)
> Quandl.auth("yourauthenticationtoken")
> G <- Quandl('GOOG/NASDAQ_GOOG',
+   start_date = '2009-06-01', end_date = '2013-06-01')

The resulting G is a variable containing 6 variables, from which we only need the Close values:

> str(G)
'data.frame':     1018 obs. of  6 variables:
 $ Date  : Date, format: "2009-06-01" "2009-06-02" ...
 $ Open  : num  419 426 426 435...
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