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: 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
## # A tibble: 766 x 4
## # Groups:   symbol [3]
##    symbol date            Ra    Rb
##    <chr>  <date>       <dbl> <dbl>
##  1 AAPL   1990-04-30  0         NA
##  2 AAPL   1990-05-31  0.0505    NA
##  3 AAPL   1990-06-29  0.0848    NA
##  4 AAPL   1990-07-31 -0.0615    NA
##  5 AAPL   1990-08-31 -0.116     NA
##  6 AAPL   1990-09-28 -0.216     NA
##  7 AAPL   1990-10-31  0.0603    NA
##  8 AAPL   1990-11-30  0.199     NA
##  9 AAPL   1990-12-31  0.170     NA
## 10 AAPL   1991-01-31  0.291     NA
## # … 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.192 0.0185           0.245  1.20    1.11   1.31        0.637
## 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.

Q3 Import baseline prices and calculate its monthly return.

Hint: Use NASDAQ Compsite Index as baseline.

## # 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.

On average Apple did .02% better then the market monthly. Microsoft on average did .007% monthly better then the market. Amazon on average did .0174% monthly better then the market.

Q7 Interpret the beta.

Amazon is the most volitile with the highest beta of 1.34% which is 34% more then Nasdaq and Microsoft has a vey low volitility with .867% this means that microsoft is 10% less volitle then the market. Apple is in the middle which is 1.20 which means it’s 20% more volitile then the market.

Q8 Hide the messages and the code, but display results of the code from the webpage.

Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.