Introduction to Portfolio Analysis in R
Apply your finance and R skills to backtest, analyze, and optimize financial portfolios.
Start Course for Free5 hours14 videos57 exercises33,689 learnersStatement of Accomplishment
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Training 2 or more people?
Try DataCamp for BusinessLoved by learners at thousands of companies
Course Description
A golden rule in investing is to always test the portfolio strategy on historical data, and, once you are trading the strategy, to constantly monitor its performance. In this course, you will learn this by critically analyzing portfolio returns using the package PerformanceAnalytics. The course also shows how to estimate the portfolio weights that optimally balance risk and return. This is a data-driven course that combines portfolio theory with the practice in R, illustrated on real-life examples of equity portfolios and asset allocation problems. If you'd like to continue exploring the data after you've finished this course, the data used in the first three chapters can be obtained using the tseries-package.
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
Finance Fundamentals in R
Go To TrackQuantitative Analyst in R
Go To Track- 1
The Building Blocks
FreeAsset returns and portfolio weights; those are the building blocks of a portfolio return. This chapter is about computing those portfolio weights and returns in R.
Welcome to the course50 xpGetting a grasp of the basics50 xpGet a feel for the data100 xpThe portfolio weights50 xpCalculating portfolio weights when component values are given100 xpThe weights of an equally weighted portfolio50 xpThe weights of a market capitalization-weighted portfolio100 xpThe portfolio return50 xpCalculation of portfolio returns100 xpFrom simple to gross and multi-period returns50 xpThe asymmetric impact of gains and losses50 xpPerformanceAnalytics50 xpBuy-and-hold versus (daily) rebalancing50 xpThe time series of asset returns100 xpThe time series of portfolio returns100 xpThe time series of weights100 xp - 2
Analyzing Performance
The history of portfolio returns reveals valuable information about how much the investor can expect to gain or lose. This chapter introduces the R functionality to analyze the investment performance based on a statistical analysis of the portfolio returns. It includes graphical analysis and the calculation of performance statistics expressing average return, risk, and risk-adjusted return over rolling estimation samples.
Dimensions of portfolio performance50 xpExploring the monthly S&P 500 returns100 xpThe monthly mean and volatility100 xpThe (annualized) Sharpe ratio50 xpExcess returns and the portfolio's Sharpe ratio100 xpAnnualized mean and volatility100 xpTime-variation in portfolio performance50 xpEffect of window length choice50 xpRolling annualized mean and volatility100 xpSubperiod performance analysis and the function window100 xpNon-normality of the return distribution50 xpBalancing risk and reward50 xpDetecting non-normality using skewness and kurtosis100 xpDownside risk measures100 xpDrawdowns due to buying high, selling low100 xp - 3
Performance Drivers
In addition to studying portfolio performance based on the observed portfolio return series, it is relevant to determine how individual (expected) returns, volatilities, and correlations interact to determine the total portfolio performance.
Drivers in the case of two assets50 xpDriver 1: The assets' individual performance50 xpDriver 2: The choice of portfolio weights100 xpDriver 3: The correlation between the asset returns50 xpInterpreting correlation100 xpUsing matrix notation50 xpMaking a risk-reward scatter diagram100 xpThe covariance matrix100 xpMatrix-based calculation of portfolio mean and variance100 xpPortfolio risk budget50 xpWho did it?100 xp - 4
Optimizing the Portfolio
We have up to now considered the portfolio weights as given. In this chapter, you learn how to determine in R the portfolio weights that are optimal in terms of achieving a target return with minimum variance, while satisfying constraints on the portfolio weights.
Modern portfolio theory of Harry Markowitz50 xpMean-variance based investing in DJIA stocks50 xpExploring monthly returns of the 30 DJIA stocks100 xpFinding the mean-variance efficient portfolio100 xpEffect of the return target100 xpImposing weight constraints100 xpThe efficient frontier50 xpComputing the efficient frontier using a grid of target returns100 xpInterpreting the efficient frontier50 xpProperties of the efficient frontier50 xpThe minimum variance and maximum Sharpe ratio portfolio100 xpIn-sample vs. out-of-sample evaluation50 xpSplit-sample evaluation100 xpOut of sample performance evaluation100 xpIt ain't over100 xp
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
Finance Fundamentals in R
Go To TrackQuantitative Analyst in R
Go To Trackdatasets
Stock prices for Apple and MicrosoftBonds pricesCommodities pricesEquities pricesStock prices for DIJAReal estate pricesDaily prices in S&P 500collaborators
prerequisites
Intermediate R for FinanceKris Boudt
See MoreProfessor of Finance and Econometrics at VUB and VUA
What do other learners have to say?
Join over 15 million learners and start Introduction to Portfolio Analysis in R today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.