Portfolio Construction using R

Portfolio Construction using R


Create a portfolio of stocks using stock price histories downloaded from Yahoo. We create an efficient frontier for a long-only portfolio and show how to graphically display the risk-return tradeoff and the allocations. We next show how to compare frontiers created with other constraints and compare them to the original long-only frontier
the R code is available on http://wp.me/pTp8L-3j
Closed Caption:

in this video we'll look at portfolio
construction using our well first
reading prices and will create efficient
frontiers and show how to display the
returns the allocation and then we'll do
a comparison of two different portfolios
with two different sets of constraints
we first start by copying the code and
pasting it into our what this will do is
this will download stock price history
for five different technology stocks
once you download the data will then
calculate the efficient frontier so we
copy and paste the commands and then
what after it's calculated the efficient
frontier it will plot the risk-return
space which is their next thing we want
to do is you want to look at some key
points within the efficient frontier
so for instance we want to look at
the Sharpe ratio the tangent line
we can also do this interactively and
first of all we plotted the efficient
frontier with selection number one this
is the minimum variance portfolio and
then lastly we plotted out three stocks
in terms of their where they sit on the
risk-return space and then we can use 0
to exit out next we want to take a look
at what the inputs were to the process
so what we're going to do is we're going
to print out what the main returns were
for the five stocks and what the
covariance matrix was one of the things
you want to do is one also convert from
daily returns and risk to analyze
numbers and so the following code they
were cutting and pasting will do this
next we want to look at what the Sharpe
ratios were for each one of the points
on the efficient frontier remember
previously one of the points in the
upper-right was the maximum sharp point
where the tangency line was the first we
create a new page so we don't overwrite
the previous plot we plotted up and one
of the higher points in the upper right
of the efficient frontier is also the
highest point with the Sharpe ratio and
then finally we want to do is you want
to count you want to graphically display
with the allocation reach the 50 points
so we started the lower . and go to the
the upper right . and it shows you what
the various applications are and we can
also print these print out what the
allocation was free to the 50 points and
we can also print out what the what the
risk and return was then we can scroll
through this one other thing that we
that also is useful is for us to be able
to write these data out so in this case
I've taken the allocation and I wanted
to write that out to a CSV file up
getting important to excel so do right
csb give it the name of the variable and
the filename and then I want to make
want to know where the file is actually
stored so i use to get WD command to
tell me what directory is the one where
I've stored the csv file so that
completes doing the creating the
efficient frontier
next we want to do is you want to do a
comparison of the efficient frontier for
the currency current portfolio which is
a long-only so zero to a hundred percent
versus some alternatives so we have a
line custody constraints which says
that we now can allocate have
allocations down to minus a hundred
percent for each one of the stocks we
copy this code which calculates the new
efficient frontier with the constraint 0
minus $OPERAND minus 1 to plus 1 versus
the original which appears in the blue
or the red is the beacons the one that
laws long and short positions the blue
is longing we can also try other types
of constraints so the one example here
says that every stock much doesn't have
at least ten percent of the portfolio
what kind of a maximum 60-percent we
copy that constraint paste it in and we
copy the same code we had before except
for that first line which has the
constraint and then we paste and the
blue is the original long-only portfolio
the red shows the portfolio is
restricted to ten percent the sixty
percent the show this graphically we go
back and copy our code to print out
graphically what the allocation look
like and this is what it looks like you
notice that everything
each one of the five stocks at least ten
percent allocation and also we we can
also print out the matrix showing what
the allocation was for each of the
points on the efficient frontier and
that's the original efficient frontier
that's the new allocated new allocation
across the frontier to do a comparison
of how the 10-percent of sixty percent
location compares to the long only
allocation we first of all recreate the
long only portfolio by talking the code
pasting it in
now we created the original long-only
portfolio and now we copy the the code
that produces the bar chart chart
showing what the allocation was we print
that out what first of all we use devenu
to create a new window and then we plot
the long lonely allocation in a new
window and then we can move the windows
apart to see how the allocation of
different the original long only on the
left the ten percent on the right

Video Length: 07:58
Uploaded By: Elliot Noma
View Count: 17,719

Related Software Products
Portfolio Optimization
Portfolio Optimization

Published By:
Business Spreadsheets

Description:
The Portfolio Optimization model calculates the optimal capital weightings for a basket of financial investments that gives the highest return for the least risk. The unique design of the model enables it to be applied to either financial instrument or business portfolios. The ability to apply optimization analysis to a portfolio of businesses represents an excellent framework for driving capital allocation, investment, and divestment decisions. The key features of the Portfolio Optimization ...


Related Videos
Portfolio Optimization in Excel.mp4
Portfolio Optimization in Excel.mp4

This is a video created by Dr. Colby Wright demonstrating how to use the matrix algebra and solver functions in Excel in order to optimize the weights within a portfolio comprised of more than two assets. Please note, this is limited to mean-variance optimization and does not consider higher moments (such as skewness and kurtosis). This method of optimizing portfolio weights also assumes that the distribution of past returns is reflective of the distribution of future returns, which is often ...
Video Length: 19:22
Uploaded By: Colby Wright
View Count: 202,178

Optimal portfolios with Excel Solver
Optimal portfolios with Excel Solver

This is an instuction video on how to use Excel's solver for calculating efficient portfolios hr / bClosed Caption:/b this is alkyl planta and i'm going to show you in this movie how to calculate the portfolio and short sales constraint and i'm using an example with five different assets ABC and D and E and have the expected returns and standard deviations in the columns B and C and here we have the covariance ...
Video Length: 06:23
Uploaded By: Auke Plantinga
View Count: 163,688

Generating the Variance-Covariance Matrix
Generating the Variance-Covariance Matrix

This is a follow-up video to a video posted previously by Dr. Colby Wright explaining how to execute mean-variance portfolio optimization in Excel. This video demonstrates how to generate the variance-covariance matrix, which is necessary in order to calculate the portfolio standard deviation. Dr. Wright also demonstrates how to transform the var-cov matrix into the correlation matrix. hr / bClosed Caption:/b hello everyone this is dr. right again a couple months ...
Video Length: 18:42
Uploaded By: Colby Wright
View Count: 156,335

Tutorial: Constructing Efficient Frontier using Markowitz model
Tutorial: Constructing Efficient Frontier using Markowitz model

This tutorial shows how to calculate portfolio efficient frontier comprised of common stocks. It relies on Markowitz model and mean-variance optimization. All calculations are performed in Microsoft Excel with the help of Solver add-in in MS Excel. The data and examples are posted here: http://valexeev.yolasite.com/teaching.php hr / bClosed Caption:/b hello everyone the tutorial on constructing the portfolio efficient frontier using the workers model thebr ...
Video Length: 15:48
Uploaded By: Vitali Alexeev
View Count: 34,738

Efficient Frontier
Efficient Frontier

In this video, Dr Paul Docherty from The University of Newcastle (Australia) describes the portfolio optimisation and the efficient frontier. The video includes a demonstration of how Microsoft Excel's Solver addin can be used to derive the efficient frontier. hr / bClosed Caption:/b I'm going to this instructional video on how to derive the efficient frontier using Microsoft XO this video has been created for students and portfolio management ...
Video Length: 24:06
Uploaded By: Paul Docherty
View Count: 26,347

Getting Started with Portfolio Optimization
Getting Started with Portfolio Optimization

Get a Free Trial: https://goo.gl/C2Y9A5 Get Pricing Info: https://goo.gl/kDvGHt Ready to Buy: https://goo.gl/vsIeA5 Create and optimize portfolios of assets using the portfolio object in Financial Toolbox, together with Datafeed Toolbox. For more videos, visit http://www.mathworks.com/products/fin... hr / bClosed Caption:/b this video will show you how to use the portfolio object to formulate and solve a range of asset allocation problemsbr ...
Video Length: 13:36
Uploaded By: MATLAB
View Count: 13,224

Portfolio Optimization
Portfolio Optimization

www.vosesoftware.com. ModelRisk is the most advanced risk modeling software in the world. To download your 30 day free trial, please visit: www.vosesoftware.com/trial.php hr / bClosed Caption:/b during this tutorial we will be highlighting it AP portfolio optimization model as a vehicle for highlighting several features model risk in particular the optimization functionality built into model riskbr ...
Video Length: 09:47
Uploaded By: ModelRisk
View Count: 10,430

Value at Risk - based Portfolio Optimization
Value at Risk - based Portfolio Optimization

Dr. Emanuele Canegrati explains the future of Portfolio Optimization Techniques which respects Basle II Protocol to manage the market risks of banks and financial institutions hr / bClosed Caption:/b hello everybody and I want to discuss today the value at risk the spur for the optimization which he is and may appear in very useful to which in the future as whose will be a sort of benchmarks for four you up to ease ...
Video Length: 10:44
Uploaded By: quantsfinance
View Count: 7,225

Investment Science: Portfolio Optimization
Investment Science: Portfolio Optimization

Tucker Balch, Ph.D., Lucena's CTO describes the science and algorithms behind portfolio optimization. hr / bClosed Caption:/b Hall hot of of home of I am after soccer ball with him soon research and in this video minute tell you about portfolio optimization now this video is about the science a portfolio optimization there's another video that tells you how to use the portfolio optimizer ...
Video Length: 18:09
Uploaded By: Tucker Balch
View Count: 7,087

CVaR Portfolio Optimization
CVaR Portfolio Optimization

Get a Free Trial: https://goo.gl/C2Y9A5 Get Pricing Info: https://goo.gl/kDvGHt Ready to Buy: https://goo.gl/vsIeA5 Create and optimize Conditional Value at Risk portfolios. For more videos, visit http://www.mathworks.com/products/fin... hr / bClosed Caption:/b in this video we will show conditional value at risk portfolio optimization in the financial tool box using the portfolio see bar object using these tools you can ...
Video Length: 05:38
Uploaded By: MATLAB
View Count: 6,837

Copyright © 2025, Ivertech. All rights reserved.