This advanced undergraduate/graduate textbook teaches students in finance and economics how to use R to analyse financial data and implement financial models. It demonstrates how to take publically available data and manipulate, implement models and generate outputs typical for particular analyses.
Analyzing Financial Data and Implementing Financial Models Using R
โ Scribed by Clifford S. Ang
- Publisher
- Springer
- Year
- 2021
- Tongue
- English
- Leaves
- 476
- Series
- Springer Texts in Business and Economics
- Edition
- 2
- Category
- Library
No coin nor oath required. For personal study only.
โฆ Table of Contents
Preface
Acknowledgments
Contents
1 Prices
1.1 Price Versus Value
1.2 Importing Price Data from Yahoo Finance
1.3 Checking the Data
1.3.1 Check the Start and End Data
1.3.2 Plotting the Data
1.3.3 Checking the Dimension
1.3.4 Outputting Summary Statistics
1.3.5 Checking the Ticker Symbol
1.4 Basic Data Manipulation Techniques
1.4.1 Keeping and Deleting One Row
1.4.2 Keeping First and Last Rows
1.4.3 Keeping Contiguous Rows
1.4.4 Keeping One Column
1.4.5 Deleting One Column
1.4.6 Keeping Non-Contiguous Columns
1.4.7 Keeping Contiguous Columns
1.4.8 Keeping Contiguous and Non-Contiguous Columns
1.4.9 Keeping Rows and Columns
1.4.10 Subsetting Time Series Data Using Dates
1.4.11 Converting to Weekly Prices
1.4.12 Converting to Monthly Prices
1.5 Comparing Capital Gains Between Securities
1.5.1 Alternative 1โUsing xts-Style Chart
1.5.2 Alternative 2โPlotting Four Mini-Charts
1.5.3 Alternative 3โUsing ggplot to Plot FourMini-Charts
1.6 Simple and Exponential Moving Averages
1.7 Volume-Weighted Average Price
1.8 Plotting a Candlestick Chart
1.9 2-Axis Price and Volume Chart
1.10 Further Reading
References
2 Individual Security Returns
2.1 Price Returns
2.2 Total Returns
2.3 Logarithmic Total Returns
2.4 Winsorization and Truncation
2.5 Cumulating Multi-Day Returns
2.5.1 Cumulating Arithmetic Returns
2.5.2 Cumulating Logarithmic Returns
2.5.3 Comparing Price Return and Total Return
2.6 Weekly Returns
2.7 Monthly Returns
2.8 Comparing Performance of Multiple Securities
2.8.1 Using Normalized Prices
2.8.2 Using Cumulative Returns
3 Portfolio Returns
3.1 Portfolio Returns the Long Way
3.2 Portfolio Returns Using Matrix Algebra
3.3 Constructing Benchmark Portfolio Returns
3.3.1 Quarterly Returns the Long Way
3.3.2 Quarterly Returns the Shorter Way
3.3.3 Equal-Weighted Portfolio
3.3.4 Value-Weighted Portfolio
3.3.5 Daily Portfolio Returns
3.4 Time-Weighted Rate of Return
3.5 Money-Weighted Rate of Return
3.6 Further Reading
Reference
4 Risk
4.1 Risk-Return Trade-Off
4.2 Individual Security Risk
4.2.1 Standard Deviation and Variance
4.3 Portfolio Risk
4.3.1 Two Assets Using Manual Approach
4.3.2 Two Assets Using Matrix Algebra
4.3.3 Multiple Assets
4.4 Value-at-Risk
4.4.1 Gaussian VaR
4.4.2 Historical VaR
4.5 Expected Shortfall
4.5.1 Gaussian ES
4.5.2 Historical ES
4.5.3 Comparing VaR and ES
4.6 Alternative Risk Measures
4.6.1 Parkinson
4.6.2 GarmanโKlass
4.6.3 Rogers, Satchell, and Yoon
4.6.4 Yang and Zhang
4.6.5 Comparing the Risk Measures
4.7 Further Reading
References
5 Factor Models
5.1 CAPM
5.2 Market Model
5.3 Rolling Window Regressions
5.4 Betas on Different Reference Days
5.5 FamaโFrench Three Factor Model
5.6 Testing for Heteroskedasticity
5.7 Testing for Non-Normality
5.8 Testing for Autocorrelation
5.9 Event Studies
5.9.1 Example: Drop in Tesla Stock After 1Q 2019 Earnings Release on April 24, 2019
5.9.2 Single Step Event Study
5.9.3 Two Stage Event Study
5.9.4 Sample Quantiles/Non-Parametric
5.10 Selecting Best Regression Variables
5.10.1 Create Dataset of Returns
5.10.2 Forward Step Approach
5.10.3 Backward Step Approach
5.10.4 Suppressing Steps in Output
5.11 Further Reading
References
6 Risk-Adjusted Portfolio Performance Measures
6.1 Portfolio and Benchmark Data
6.2 Sharpe Ratio
6.3 Roy's Safety First Ratio
6.4 Treynor Ratio
6.5 Sortino Ratio
6.6 Information Ratio
6.7 Combining Results
6.8 Further Reading
References
7 Markowitz MeanโVariance Optimization
7.1 Two Assets the Long Way
7.2 Two Assets Using Quadratic Programming
7.3 Multiple Assets Using Quadratic Programming
7.4 Effect of Allowing Short Selling
7.5 Further Reading
References
8 Equities
8.1 Company Financials
8.2 Projections
8.2.1 Projecting Based on Historical Trends
8.2.2 Analyzing Projections Prepared by Third Parties
8.2.3 Analyzing Growth Rates Embedded in Projections
8.2.4 Analyzing Projections Using Regression Analysis
8.3 Equity Risk Premium
8.4 Unlevering Betas
8.5 Sensitivity Analysis
8.6 Relative Valuation Using Regression Analysis
8.7 Identifying Significant Shifts in Stock Returns
8.7.1 t-Test: Testing Difference in Average Returns
8.7.2 Identifying Breakpoints
8.7.3 Chow Test
8.7.4 Test Equality of Two Betas
8.8 Further Reading
References
9 Fixed Income
9.1 Economic Analysis
9.1.1 Real GDP
9.1.2 Unemployment Rate
9.1.3 Inflation Rate
9.2 US Treasuries
9.2.1 Shape of the US Treasury Yield Curve
9.2.2 Slope of the US Treasury Yield Curve
9.2.3 Real Yields on US Treasuries
9.2.4 Expected Inflation Rates
9.2.5 Mean Reversion
9.3 Principal Components Analysis
9.4 Investment Grade Bond Spreads
9.4.1 Time Series of Spreads
9.4.2 Spreads and Real GDP Growth
9.5 Bond Valuation
9.5.1 Valuing Bonds with Known Yield to Maturity
9.5.2 Bond Valuation Function
9.5.3 Finding the Yield to Maturity
9.6 Duration and Convexity
9.6.1 Calculating Duration and Convexity
9.6.2 Duration and Convexity Functions
9.6.3 Comparing Estimates of Value to Full Valuation
9.7 Short Rate Models
9.7.1 Vasicek
9.7.2 Cox, Ingersoll, and Ross
9.8 Further Reading
References
10 Options
10.1 Obtaining Options Chain Data
10.2 BlackโScholesโMerton Options Pricing Model
10.2.1 BSM Function
10.2.2 PutโCall Parity
10.2.3 The Greeks
10.3 Implied Volatility
10.3.1 Implied Volatility Function
10.3.2 Volatility Smile
10.3.3 Gauging Market Risk
10.4 The Cox, Ross, and Rubinstein Binomial OPM
10.4.1 CRR: The Long Way
10.4.2 CRR Function
10.5 American Option Pricing
10.5.1 CRR Binomial Tree
10.5.2 BjerksundโStensland Approximation
10.6 Further Reading
References
11 Simulation
11.1 Simulating Stock Prices Using Geometric Brownian Motion
11.1.1 Simulating Multiple Ending Stock Price Paths
11.1.2 Comparing Theoretical to Empirical Distributions
11.2 Simulating Stock Prices with and Without Dividends
11.3 Simulating Stocks with Correlated Prices
11.4 Value-at-Risk Using Simulation
11.5 Monte Carlo Pricing of European Options
11.6 Monte Carlo Option Pricing Using Antithetic Variables
11.7 Exotic Option Valuation
11.7.1 Asian Options
11.7.2 Lookback Options
11.7.3 Barrier Options
11.8 Further Reading
References
12 Trading Strategies
12.1 Efficient Markets Hypothesis
12.1.1 Autocorrelation Test
12.1.2 Variance Ratio Test
12.1.3 Runs Test
12.2 Technical Analysis
12.2.1 Trend: Simple Moving Average Crossover
12.2.2 Volatility: Bollinger Bands
12.2.3 Momentum: Relative Strength Index
12.3 Building a Simple Trading Strategy
12.4 Machine Learning Techniques
12.4.1 General Steps to Apply ML
12.4.2 k-Nearest Neighbor Algorithm
12.4.3 Regression and k-Fold Cross Validation
12.4.4 Artificial Neural Networks
12.5 Further Reading
References
A Getting Started with R
A.1 Installing R
A.2 The R Working Directory
A.3 R Console Output
A.4 R Editor
A.5 Packages
A.6 Basic Commands
A.7 The R Workspace
A.8 Vectors
A.9 Combining Vectors
A.10 Matrices
A.11 data.frame
A.12 Date Formats
B Pre-Loaded Code
C Constructing a Hypothetical Portfolio (Monthly Returns)
D Constructing a Hypothetical Portfolio (Daily Returns)
Index
๐ SIMILAR VOLUMES
<p><p>This book is a comprehensive introduction to financial modeling that teaches advanced undergraduate and graduate students in finance and economics how to use R to analyze financial data and implement financial models. This text will show students how to obtain publicly available data, manipula
I must agree with the other reviewers of Sengupta's very weak effort. This book is overly simplistic and of very little use to any true financial professional. For an excellent overview of financial modeling in general, look at Ragsdale 5e or The Art of Modeling with Spreadsheets by Powell of the
<div><p>The financial industry has adopted Python at a tremendous rate recently, with some of the largest investment banks and hedge funds using it to build core trading and risk management systems. This hands-on guide helps both developers and quantitative analysts get started with Python, and guid
<div><p>The financial industry has adopted Python at a tremendous rate recently, with some of the largest investment banks and hedge funds using it to build core trading and risk management systems. This hands-on guide helps both developers and quantitative analysts get started with Python, and guid
<div><p>The financial industry has adopted Python at a tremendous rate recently, with some of the largest investment banks and hedge funds using it to build core trading and risk management systems. This hands-on guide helps both developers and quantitative analysts get started with Python, and guid