This note came from Matt Dancho’s webpage.

Factor models are used in many financial appplications, suhc as:

Capital Asset Pricing Model (CAPM) is the most popular factor model. Although CAPM does not perform well in empirical testing, it’s important because it provides a starting point of many cost of capital calculations.

## # A tibble: 16,019 x 8
## # Groups:   symbol [3]
##    symbol date        open  high   low close   volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>    <dbl>
##  1 AAPL   1990-04-30  1.40  1.42  1.39  1.41 34098400     1.14
##  2 AAPL   1990-05-01  1.42  1.43  1.41  1.42 40902400     1.15
##  3 AAPL   1990-05-02  1.42  1.43  1.40  1.42 33857600     1.15
##  4 AAPL   1990-05-03  1.42  1.44  1.42  1.43 41577200     1.16
##  5 AAPL   1990-05-04  1.43  1.46  1.40  1.43 42383600     1.16
##  6 AAPL   1990-05-07  1.42  1.49  1.42  1.48 33997600     1.21
##  7 AAPL   1990-05-08  1.46  1.5   1.46  1.49 28114800     1.21
##  8 AAPL   1990-05-09  1.49  1.5   1.47  1.50 24309600     1.22
##  9 AAPL   1990-05-10  1.49  1.49  1.45  1.48 44760800     1.20
## 10 AAPL   1990-05-11  1.48  1.53  1.46  1.52 53810400     1.24
## # … with 16,009 more rows
## # A tibble: 766 x 3
## # Groups:   symbol [3]
##    symbol date            Ra
##    <chr>  <date>       <dbl>
##  1 AAPL   1990-04-30  0     
##  2 AAPL   1990-05-31  0.0505
##  3 AAPL   1990-06-29  0.0848
##  4 AAPL   1990-07-31 -0.0615
##  5 AAPL   1990-08-31 -0.116 
##  6 AAPL   1990-09-28 -0.216 
##  7 AAPL   1990-10-31  0.0603
##  8 AAPL   1990-11-30  0.199 
##  9 AAPL   1990-12-31  0.170 
## 10 AAPL   1991-01-31  0.291 
## # … with 756 more rows
## # A tibble: 361 x 2
##    date             Rb
##    <date>        <dbl>
##  1 1990-04-30  0      
##  2 1990-05-31  0.0926 
##  3 1990-06-29  0.00719
##  4 1990-07-31 -0.0521 
##  5 1990-08-31 -0.130  
##  6 1990-09-28 -0.0963 
##  7 1990-10-31 -0.0427 
##  8 1990-11-30  0.0888 
##  9 1990-12-31  0.0409 
## 10 1991-01-31  0.108  
## # … with 351 more rows
## # A tibble: 766 x 4
## # Groups:   symbol [3]
##    symbol date            Ra       Rb
##    <chr>  <date>       <dbl>    <dbl>
##  1 AAPL   1990-04-30  0       0      
##  2 AAPL   1990-05-31  0.0505  0.0926 
##  3 AAPL   1990-06-29  0.0848  0.00719
##  4 AAPL   1990-07-31 -0.0615 -0.0521 
##  5 AAPL   1990-08-31 -0.116  -0.130  
##  6 AAPL   1990-09-28 -0.216  -0.0963 
##  7 AAPL   1990-10-31  0.0603 -0.0427 
##  8 AAPL   1990-11-30  0.199   0.0888 
##  9 AAPL   1990-12-31  0.170   0.0409 
## 10 AAPL   1991-01-31  0.291   0.108  
## # … with 756 more rows
## # A tibble: 3 x 13
## # Groups:   symbol [3]
##   symbol ActivePremium  Alpha AnnualizedAlpha  Beta `Beta-` `Beta+` Correlation
##   <chr>          <dbl>  <dbl>           <dbl> <dbl>   <dbl>   <dbl>       <dbl>
## 1 AAPL          0.0949 0.0122           0.156  1.08    1.04   1.12        0.543
## 2 GOOG          0.126  0.0115           0.147  1.02    1.06   0.889       0.557
## 3 NFLX          0.290  0.0306           0.435  1.17    1.15   0.799       0.354
## # … with 5 more variables: `Correlationp-value` <dbl>, InformationRatio <dbl>,
## #   `R-squared` <dbl>, TrackingError <dbl>, TreynorRatio <dbl>

Interpretation

Q1 Import stock prices of Apple, Microsoft and Amazon for the last 20 years.

## # A tibble: 15,090 x 8
## # Groups:   symbol [3]
##    symbol date        open  high   low close    volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>     <dbl>    <dbl>
##  1 AAPL   2000-04-28  4.54  4.55  4.33  4.43  62395200     3.85
##  2 AAPL   2000-05-01  4.46  4.47  4.35  4.44  56548800     3.85
##  3 AAPL   2000-05-02  4.40  4.51  4.20  4.21  59108000     3.65
##  4 AAPL   2000-05-03  4.25  4.33  3.99  4.11 122449600     3.57
##  5 AAPL   2000-05-04  4.11  4.12  3.95  3.95  99878800     3.43
##  6 AAPL   2000-05-05  3.96  4.10  3.95  4.04  71019200     3.51
##  7 AAPL   2000-05-08  4.00  4.06  3.93  3.93  46225200     3.41
##  8 AAPL   2000-05-09  3.94  3.97  3.75  3.77  81785200     3.27
##  9 AAPL   2000-05-10  3.72  3.75  3.53  3.55 133772800     3.08
## 10 AAPL   2000-05-11  3.62  3.72  3.54  3.67 124936000     3.19
## # … with 15,080 more rows

Q2 Calculate monthly returns.

## # A tibble: 723 x 3
## # Groups:   symbol [3]
##    symbol date            Ra
##    <chr>  <date>       <dbl>
##  1 AAPL   2000-04-28  0     
##  2 AAPL   2000-05-31 -0.323 
##  3 AAPL   2000-06-30  0.247 
##  4 AAPL   2000-07-31 -0.0298
##  5 AAPL   2000-08-31  0.199 
##  6 AAPL   2000-09-29 -0.577 
##  7 AAPL   2000-10-31 -0.240 
##  8 AAPL   2000-11-30 -0.157 
##  9 AAPL   2000-12-29 -0.0985
## 10 AAPL   2001-01-31  0.454 
## # … with 713 more rows

Q3 Import baseline prices and calculate its monthly return.

## # A tibble: 241 x 2
##    date            Rb
##    <date>       <dbl>
##  1 2000-04-28  0     
##  2 2000-05-31 -0.119 
##  3 2000-06-30  0.166 
##  4 2000-07-31 -0.0502
##  5 2000-08-31  0.117 
##  6 2000-09-29 -0.127 
##  7 2000-10-31 -0.0825
##  8 2000-11-30 -0.229 
##  9 2000-12-29 -0.0490
## 10 2001-01-31  0.122 
## # … with 231 more rows

Q4 Merge the two sets of monthly returns.

## # A tibble: 723 x 4
## # Groups:   symbol [3]
##    symbol date            Ra      Rb
##    <chr>  <date>       <dbl>   <dbl>
##  1 AAPL   2000-04-28  0       0     
##  2 AAPL   2000-05-31 -0.323  -0.119 
##  3 AAPL   2000-06-30  0.247   0.166 
##  4 AAPL   2000-07-31 -0.0298 -0.0502
##  5 AAPL   2000-08-31  0.199   0.117 
##  6 AAPL   2000-09-29 -0.577  -0.127 
##  7 AAPL   2000-10-31 -0.240  -0.0825
##  8 AAPL   2000-11-30 -0.157  -0.229 
##  9 AAPL   2000-12-29 -0.0985 -0.0490
## 10 AAPL   2001-01-31  0.454   0.122 
## # … with 713 more rows

Q5 Calculate performance metrics, CAPM measures.

## # A tibble: 3 x 13
## # Groups:   symbol [3]
##   symbol ActivePremium  Alpha AnnualizedAlpha  Beta `Beta-` `Beta+` Correlation
##   <chr>          <dbl>  <dbl>           <dbl> <dbl>   <dbl>   <dbl>       <dbl>
## 1 AAPL          0.197  0.0188          0.251  1.20    1.11    1.31        0.638
## 2 MSFT          0.0661 0.0069          0.0864 0.867   0.594   0.998       0.679
## 3 AMZN          0.165  0.0174          0.231  1.34    1.34    1.50        0.616
## # … with 5 more variables: `Correlationp-value` <dbl>, InformationRatio <dbl>,
## #   `R-squared` <dbl>, TrackingError <dbl>, TreynorRatio <dbl>

Q6 Interpet the alpha.

All three stocks did better than the broad market. Apple beats the market by .019% per month on average. Microsoft beats the market by .007% per month on average. Amazon beats the market by .017% per month on average.

Q7 Interpret the beta.

Amazon is the riskiest stock, providing a 33% greater return than the market, but also suffering from 33% greater losses during downturns. Apple provides a 20% greater return than the market, while also suffering from 20% greater losses during downturns. Microsoft is the least risky stock, providing 10% less returns during positive market runs, but 10% less losses during downturns.