Goal

Calculate and visualize your portfolio’s beta.

Choose your stocks and the baseline market.

from 2012-12-31 to present

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: 167 × 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 
## # ℹ 157 more rows

5 Calculate CAPM Beta

5.1 Get market returns

5.2 Join returns

5.3 CAPM Beta

## # A tibble: 1 × 1
##   CAPM.beta.1
##         <dbl>
## 1        1.23

Plot

Scatterplot of returns with regression line

Line plot of fitted vs actual returns

How sensitive is your portfolio to the market? Discuss in terms of the beta coefficient. Does the plot confirm the beta coefficient you calculated?

The portfolio can definitely move more than the market, seeing a beta of 1.23. This means that the portfolio moves 23% more in comparison to the market. This is confirmed by the line plot of returns, the actual returns have higher highs and lover lows than the market.