Q1 Import stock prices of NASDAQ Compsite Index, Microsoft and Walmart for the last 30 years.

## # 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 ^IXIC  1989-11-07  447   449.  447.  449. 130550000     449.
##  2 ^IXIC  1989-11-08  452.  454.  450.  454. 137900000     454.
##  3 ^IXIC  1989-11-09  455.  455.  454.  454. 126790000     454.
##  4 ^IXIC  1989-11-10  455.  456.  455.  456. 109050000     456.
##  5 ^IXIC  1989-11-13  457.  457.  455.  456. 109200000     456.
##  6 ^IXIC  1989-11-14  456   456.  453.  454  123770000     454 
##  7 ^IXIC  1989-11-15  455.  456.  453.  456. 133010000     456.
##  8 ^IXIC  1989-11-16  456.  457.  454.  455. 146640000     455.
##  9 ^IXIC  1989-11-17  455   457.  455.  457. 121390000     457.
## 10 ^IXIC  1989-11-20  457.  458.  454   456. 114920000     456.
## # … with 22,667 more rows

Q2 Calculate yearly returns.

## # A tibble: 93 x 3
## # Groups:   symbol [3]
##    symbol date       yearly.returns
##    <chr>  <date>              <dbl>
##  1 ^IXIC  1989-12-29         0.0120
##  2 ^IXIC  1990-12-31        -0.178 
##  3 ^IXIC  1991-12-31         0.569 
##  4 ^IXIC  1992-12-31         0.155 
##  5 ^IXIC  1993-12-31         0.147 
##  6 ^IXIC  1994-12-30        -0.0320
##  7 ^IXIC  1995-12-29         0.399 
##  8 ^IXIC  1996-12-31         0.227 
##  9 ^IXIC  1997-12-31         0.216 
## 10 ^IXIC  1998-12-31         0.396 
## # … with 83 more rows

Q3 Which of the three stocks has the highest expected yearly return?

Microsoft has the highest expected yearly return.

## # A tibble: 3 x 2
##   symbol returns_avg
##   <chr>        <dbl>
## 1 ^IXIC        0.134
## 2 MSFT         0.284
## 3 WMT          0.159

Q4 Calculate standard deviation of the yearly returns. Which of the three stocks is the riskiest in terms of standard deviation?

Microsoft is the riskiest in terms of the standard decviation because its standard deviatio is higher than both Walmart and NASDAQ Index.

## # A tibble: 3 x 2
## # Groups:   symbol [3]
##   symbol  sd.1
##   <chr>  <dbl>
## 1 ^IXIC  0.277
## 2 MSFT   0.408
## 3 WMT    0.326

Q5 Is the standard deviation appropriate measure of risk for the three stocks? Calculate skewness and kurtosis, and make your argument using them.

The standard deviation under estimates the level of risk of the three stocks. Based on skewness and kurtosis Walmart exceeds zero meaning a large return is likely to happen.

## # A tibble: 3 x 2
## # Groups:   symbol [3]
##   symbol skewness.1
##   <chr>       <dbl>
## 1 ^IXIC       0.181
## 2 MSFT        0.228
## 3 WMT         1.36
## # A tibble: 3 x 2
## # Groups:   symbol [3]
##   symbol kurtosis.1
##   <chr>       <dbl>
## 1 ^IXIC       0.362
## 2 MSFT        0.249
## 3 WMT         1.35

Q6 Calculate VaR, a downside risk measure, with a confidence interval of 0.99. Which of the three stocks has the greatest downside risk in terms of VaR?

Microsoft has the greatest downside risk in terms of VaR because it has a higher negative number. The value at risk is greater than the other two stocks meaning the risk of loss of investment is much likely to happen to Microsoft.

##        [,1]         [,2]         [,3]        
## symbol "^IXIC"      "MSFT"       "WMT"       
## VaR    "-0.4842999" "-0.5991879" "-0.1414682"

Q7 Calculate Sharpe ratios with an annualized risk-free rate of 2% and a confidence interval of 0.99. Which of the three stocks would you choose?

Out of the three stocks I would choose Walamrt because it has the higest sharp ratio. The higher a funds sharp ratio, the better the returns. Also meaning a greater expected return per unit of risk.

## # 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 ^IXIC                  0.196                   0.410                0.235
## 2 MSFT                   0.373                   0.646                0.440
## 3 WMT                    0.139                   0.428                0.985

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.