Goal

Visualize expected returns and risk to make it easier to compare the performance of multiple assets and portfolios.

Choose your stocks.

from 2012-12-31 to 2017-12-31

1 Import stock prices

2 Convert prices to returns

3 Assign a weight to each asset

## [1] "AMZN" "GOOG" "SOXX" "TKR"  "VUG"
## [1] 0.25 0.25 0.20 0.20 0.10
## # A tibble: 5 × 2
##   symbols weights
##   <chr>     <dbl>
## 1 AMZN       0.25
## 2 GOOG       0.25
## 3 SOXX       0.2 
## 4 TKR        0.2 
## 5 VUG        0.1

4 Build a portfolio

## # A tibble: 60 × 2
##    date       portfolio.returns
##    <date>                 <dbl>
##  1 2013-01-31           0.0725 
##  2 2013-02-28           0.0249 
##  3 2013-03-28           0.0163 
##  4 2013-04-30          -0.0124 
##  5 2013-05-31           0.0574 
##  6 2013-06-28           0.00642
##  7 2013-07-31           0.0398 
##  8 2013-08-30          -0.0465 
##  9 2013-09-30           0.0688 
## 10 2013-10-31           0.0626 
## # ℹ 50 more rows

5 Compute Standard Deviation

6 Plot: Expected Returns Versus Risk

## # A tibble: 6 × 3
##   asset     ArithmeticMean  Stdev
##   <chr>              <dbl>  <dbl>
## 1 AMZN              0.0257 0.0739
## 2 GOOG              0.0181 0.0535
## 3 SOXX              0.0208 0.0471
## 4 TKR               0.008  0.0722
## 5 VUG               0.0124 0.0305
## 6 Portfolio         0.0180 0.0417

The portfolio successfully balances risk and return relative to individual assets. It’s return is decent, and less volatile than most of the individual stocks.

I would perhaps invest all my money in SOXX, because the return is a bit higher and the standard deviation is only a small bit larger. I wouldn’t invest in AMZN because it has the highest volatility, and TKR is the worst option because it has high volatility and abyssmal returns which cannot justify the investment.