Demo Code

The RPCRA book has a distinctive reproducibility theme: most figures and tables in most chapters are reproducible using R scripts provided in the PCRA R package. These scripts allow students and instructors to replicate book results and experiment with different portfolio strategies, time periods, stock groups, and optimization parameters.

Download any script directly to your computer. Each script reproduces many (but not all) figures and tables for its chapter.

Chapter Topic Download Link
Chapter 1 Introduction to Portfolio Management Download R script
Chapter 2 Foundations Download R script
Chapter 3 Modeling Asset Returns Download R script
Chapter 4 Covariance Matrices Download R script
Chapter 5 Portfolio Constraints and Penalties Download R script
Chapter 6 Time Series Models Download R script
Chapter 10 Performance Analysis Download R script
Chapter 11 Expected Returns Download R script
Chapter 12 Fixed Income Portfolio Management Download R script
Chapter 15 Influence Functions and Standard Errors Download R script

Some scripts take several minutes to run in full. It usually proves more effective to run the initialization code and then run the code for selected Figures and Tables as needed.


Back to top