## # A tibble: 22,677 x 8
## # Groups: symbol [3]
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 MSFT 1989-11-07 0.538 0.572 0.536 0.562 131542400 0.363
## 2 MSFT 1989-11-08 0.570 0.587 0.569 0.578 106486400 0.373
## 3 MSFT 1989-11-09 0.583 0.587 0.573 0.582 111526400 0.375
## 4 MSFT 1989-11-10 0.583 0.590 0.582 0.587 59168000 0.379
## 5 MSFT 1989-11-13 0.587 0.613 0.582 0.612 178905600 0.395
## 6 MSFT 1989-11-14 0.616 0.620 0.597 0.601 95241600 0.388
## 7 MSFT 1989-11-15 0.602 0.620 0.599 0.615 94492800 0.397
## 8 MSFT 1989-11-16 0.618 0.620 0.599 0.608 68054400 0.392
## 9 MSFT 1989-11-17 0.609 0.613 0.602 0.603 31651200 0.389
## 10 MSFT 1989-11-20 0.602 0.602 0.587 0.601 56937600 0.388
## # … with 22,667 more rows
## # A tibble: 93 x 3
## # Groups: symbol [3]
## symbol date yearly.returns
## <chr> <date> <dbl>
## 1 MSFT 1989-12-29 0.0741
## 2 MSFT 1990-12-31 0.730
## 3 MSFT 1991-12-31 1.22
## 4 MSFT 1992-12-31 0.151
## 5 MSFT 1993-12-31 -0.0556
## 6 MSFT 1994-12-30 0.516
## 7 MSFT 1995-12-29 0.436
## 8 MSFT 1996-12-31 0.883
## 9 MSFT 1997-12-31 0.564
## 10 MSFT 1998-12-31 1.15
## # … with 83 more rows
## # A tibble: 3 x 2
## symbol returns_avg
## <chr> <dbl>
## 1 ^IXIC 0.134
## 2 MSFT 0.284
## 3 WMT 0.159
Microsoft has the highest expected yearly return with a return of about 28%.
## # A tibble: 3 x 2
## # Groups: symbol [3]
## symbol sd.1
## <chr> <dbl>
## 1 MSFT 0.408
## 2 ^IXIC 0.277
## 3 WMT 0.326
Microsoft has the highest standard diviation of 41% which means it is the most riskiest.
## # A tibble: 3 x 2
## # Groups: symbol [3]
## symbol skewness.1
## <chr> <dbl>
## 1 MSFT 0.228
## 2 ^IXIC 0.181
## 3 WMT 1.36
## # A tibble: 3 x 2
## # Groups: symbol [3]
## symbol kurtosis.1
## <chr> <dbl>
## 1 MSFT 0.249
## 2 ^IXIC 0.362
## 3 WMT 1.35
Calculating standard diviation underestimates the risk. Positive Skewness means when the tail on the right side of the distribution is longer or fatter. Positive kurtosis value indicates that the distribution has heavier tails than the normal distribution.
Hint: This is not to be confused with HistoricalVaR you calculated in class. Look for the right code, using tq_performance_fun_options().
## # A tibble: 3 x 2
## # Groups: symbol [3]
## symbol VaR
## <chr> <dbl>
## 1 MSFT -0.599
## 2 ^IXIC -0.484
## 3 WMT -0.141
I would choose microsoft because it has the greatest downside risk in terms iof VaR. It has a VaR of -.599, that is the greatest loss out of the three stocks.
Hint: Make your argument based on the three calculated Sharpe Ratios.
## # A tibble: 3 x 4
## # Groups: symbol [3]
## symbol `ESSharpe(Rf=2%,p=99… `StdDevSharpe(Rf=2%,p=… `VaRSharpe(Rf=2%,p=…
## <chr> <dbl> <dbl> <dbl>
## 1 MSFT 0.373 0.646 0.440
## 2 ^IXIC 0.196 0.410 0.235
## 3 WMT 0.139 0.428 0.985
I would choose microsoft because it has the greatest sharpe ratio.
Hint: Use message
, echo
and results
in the chunk options. Refer to the RMarkdown Reference Guide.