Suppose that you consider investing in two stocks: S&P500 and NASDAQ. As a prudent investor, you analyze the historical performance of the stocks for the past 20 years.
## # A tibble: 10,064 x 8
## # Groups: symbol [2]
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 ^DJI 1999-11-01 10731. 10746. 10649. 10649. 150060000 10649.
## 2 ^DJI 1999-11-02 10654. 10752. 10573. 10582. 143460000 10582.
## 3 ^DJI 1999-11-03 10583. 10650. 10563. 10609. 153890000 10609.
## 4 ^DJI 1999-11-04 10612. 10712. 10603. 10640. 195700000 10640.
## 5 ^DJI 1999-11-05 10640. 10843. 10638. 10704. 171660000 10704.
## 6 ^DJI 1999-11-08 10668. 10776. 10650. 10719. 213120000 10719.
## 7 ^DJI 1999-11-09 10715. 10766. 10585. 10617. 168950000 10617.
## 8 ^DJI 1999-11-10 10612. 10655. 10536. 10598. 148240000 10598.
## 9 ^DJI 1999-11-11 10603. 10644. 10544. 10595. 130060000 10595.
## 10 ^DJI 1999-11-12 10594. 10772. 10542. 10769. 158320000 10769.
## # … with 10,054 more rows
## # A tibble: 480 x 3
## # Groups: symbol [2]
## symbol date monthly.returns
## <chr> <date> <dbl>
## 1 ^DJI 1999-11-30 0.0215
## 2 ^DJI 1999-12-31 0.0569
## 3 ^DJI 2000-01-31 -0.0484
## 4 ^DJI 2000-02-29 -0.0742
## 5 ^DJI 2000-03-31 0.0784
## 6 ^DJI 2000-04-28 -0.0172
## 7 ^DJI 2000-05-31 -0.0197
## 8 ^DJI 2000-06-30 -0.00707
## 9 ^DJI 2000-07-31 0.00709
## 10 ^DJI 2000-08-31 0.0659
## # … with 470 more rows
## # A tibble: 2 x 2
## symbol returns_avg
## <chr> <dbl>
## 1 ^DJI 0.00474
## 2 ^IXIC 0.00643
^IXIC has the higher expected monthly return because it is 0.0064 and ^DJI is only 0.0047.
Hint: Calculate standard diviation
## # A tibble: 2 x 2
## # Groups: symbol [2]
## symbol sd.1
## <chr> <dbl>
## 1 ^DJI 0.0406
## 2 ^IXIC 0.0649
^IXIC is also riskier because its standard diviation is 0.065, which is higher than ^DJI with a standard diviation of 0.041.
## # A tibble: 2 x 2
## # Groups: symbol [2]
## symbol skewness.1
## <chr> <dbl>
## 1 ^DJI -0.515
## 2 ^IXIC -0.365
## # A tibble: 2 x 2
## # Groups: symbol [2]
## symbol kurtosis.1
## <chr> <dbl>
## 1 ^DJI 0.912
## 2 ^IXIC 1.55
## [,1] [,2]
## symbol "^DJI" "^IXIC"
## DownsideDeviation(0%) "0.0282" "0.0450"
## DownsideDeviation(MAR=10%) "0.0323" "0.0490"
## DownsideDeviation(Rf=0%) "0.0282" "0.0450"
## GainDeviation "0.0237" "0.0396"
## HistoricalES(95%) "-0.0937" "-0.1491"
## HistoricalVaR(95%) "-0.0625" "-0.1049"
## LossDeviation "0.0301" "0.0482"
## MaximumDrawdown "0.4930" "0.7504"
## ModifiedES(95%) "-0.0950" "-0.1572"
## ModifiedVaR(95%) "-0.0668" "-0.1046"
## SemiDeviation "0.0305" "0.0481"
Looking at HistoricalES(95%), ^DJI equals -0.0937 and ^IXIC equals -0.1491. Lookihg at HistoricalVaR(95%) ^DJI equals -0.0625 and ^IXIC equals -0.1049. Lookihg at SemiDeviation ^DJI equals 0.0305 and ^IXIC equals 0.0481. ^IXIC has the greater downside risk becasue its HistoricalES(95%), HistoricalVaR(95%), and SemiDeviation risks are all higher than ^DJI.
Hint: Calculate Sharep Ratio and discuss your answer based on calculated Sharp Ratios.
## # A tibble: 2 x 4
## # Groups: symbol [2]
## symbol `ESSharpe(Rf=0%,p=95… `StdDevSharpe(Rf=0%,p=… `VaRSharpe(Rf=0%,p=…
## <chr> <dbl> <dbl> <dbl>
## 1 ^DJI 0.0499 0.117 0.0710
## 2 ^IXIC 0.0409 0.0991 0.0615
I would choose ^DJI because it has the greater sharp ratio so it’ll have the greater expected return per unit of risk.
Hint: Use message
, echo
and results
in the chunk options. Refer to the RMarkdown Reference Guide.