by Jonathan K. Regenstein Jr. (Author)
About the Author
Jonathan K. Regenstein, Jr. is the Director of Financial Services at RStudio. He studied international relations at Harvard and law at NYU, worked at JP Morgan, and did graduate work in political economy at Emory.
About this book
Reproducible Finance with R: Code Flows and Shiny Apps for Portfolio Analysis is a unique introduction to data science for investment management that explores the three major R/finance coding paradigms, emphasizes data visualization, and explains how to build a cohesive suite of functioning Shiny applications. The full source code, asset price data and live Shiny applications are available at reproduciblefinance.com. The ideal reader works in finance or wants to work in finance and has a desire to learn R code and Shiny through simple, yet practical real-world examples.
The book begins with the first step in data science: importing and wrangling data, which in the investment context means importing asset prices, converting to returns, and constructing a portfolio. The next section covers risk and tackles descriptive statistics such as standard deviation, skewness, kurtosis, and their rolling histories. The third section focuses on portfolio theory, analyzing the Sharpe Ratio, CAPM, and Fama French models. The book concludes with applications for finding individual asset contribution to risk and for running Monte Carlo simulations. For each of these tasks, the three major coding paradigms are explored and the work is wrapped into interactive Shiny dashboards.
Table of contents
1 Introduction
Returns
2 Asset Prices to Returns
2.1 Converting Daily Prices to Monthly Returns in the xts world
2.2 Converting Daily Prices to Monthly Returns in the tidyverse
2.3 Converting Daily Prices to Monthly Returns in the tidyquant world
2.4 Converting Daily Prices to Monthly Returns with tibbletime
2.5 Visualizing Asset Returns in the xts world
2.6 Visualizing Asset Returns in the tidyverse
3 Building a Portfolio
3.1 Portfolio Returns in the xts world
3.2 Portfolio Returns in the tidyverse
3.3 Portfolio Returns in the tidyquant world
3.4 Visualizing Portfolio Returns in the xts world
3.5 Visualizing Portfolio Returns in the tidyverse
3.6 Shiny App Portfolio Returns
Concluding Returns
Risk
4 Standard Deviation
4.1 Standard Deviation in the xts world
4.2 Standard Deviation in the tidyverse
4.3 Standard Deviation in the tidyquant world
4.4 Visualizing Standard Deviation
4.5 Rolling Standard Deviation
4.6 Rolling Standard Deviation in the xts world
4.7 Rolling Standard Deviation in the tidyverse
4.8 Rolling Standard Deviation with the tidyverse and tibbletime
4.9 Rolling Standard Deviation in the tidyquant world
4.10 Visualizing Rolling Standard Deviation in the xts world
4.11 Visualizing Rolling Standard Deviation in the tidyverse
4.12 Shiny App Standard Deviation
5 Skewness
5.1 Skewness in the xts world
5.2 Skewness in the tidyverse
5.3 Visualizing Skewness
5.4 Rolling Skewness in the xts world
5.5 Rolling Skewness in the tidyverse with tibbletime
5.6 Rolling Skewness in the tidyquant world
5.7 Visualizing Rolling Skewness
6 Kurtosis
6.1 Kurtosis in the xts world
6.2 Kurtosis in the tidyverse
6.3 Visualizing Kurtosis
6.4 Rolling Kurtosis in the xts world
6.5 Rolling Kurtosis in the tidyverse with tibbletime
6.6 Rolling Kurtosis in the tidyquant world
6.7 Visualizing Rolling Kurtosis
6.8 Shiny App Skewness and Kurtosis
Concluding Risk
Portfolio Theory
7 Sharpe Ratio
7.1 Sharpe Ratio in the xts world
7.2 Sharpe Ratio in the tidyverse
7.3 Sharpe Ratio in the tidyquant world
7.4 Visualizing Sharpe Ratio
7.5 Rolling Sharpe Ratio in the xts world
7.6 Rolling Sharpe Ratio with the tidyverse and tibbletime
7.7 Rolling Sharpe Ratio with tidyquant
7.8 Visualizing the Rolling Sharpe Ratio
7.9 Shiny App Sharpe Ratio
8 CAPM
8.1 CAPM and Market Returns
8.2 Calculating CAPM Beta
8.3 Calculating CAPM Beta in the xts world
8.4 Calculating CAPM Beta in the tidyverse
8.5 Calculating CAPM Beta in the tidyquant world
8.6 Visualizing CAPM with ggplot
8.7 Augmenting Our Data
8.8 Visualizing CAPM with highcharter
8.9 Shiny App CAPM
9 Fama-French Factor Model
9.1 Importing and Wrangling Fama-French Data
9.2 Visualizing Fama-French with ggplot
9.3 Rolling Fama-French with the tidyverse and tibbletime
9.4 Visualizing Rolling Fama-French
9.5 Shiny App Fama-French
Concluding Portfolio Theory
Practice and Applications
10 Component Contribution to Standard Deviation
10.1 Component Contribution Step-by-Step
10.2 Component Contribution with a Custom Function
10.3 Visualizing Component Contribution
10.4 Rolling Component Contribution
10.5 Visualizing Rolling Component Contribution
10.6 Shiny App Component Contribution
11 Monte Carlo Simulation
11.1 Simulating Growth of a Dollar
11.2 Several Simulation Functions
11.3 Running Multiple Simulations
11.4 Visualizing Simulations with ggplot
11.5 Visualizing Simulations with highcharter
11.6 Shiny App Monte Carlo
Concluding Practice Applications
Appendix: Further Reading
Index
Series: Chapman & Hall/CRC The R Series
Length: 248 pages
Publisher: Chapman and Hall/CRC; 1 edition (October 10, 2018)
Language: English
ISBN-10: 1138484032
ISBN-13: 978-1138484030