1 General directions for this Workshop

You will work in RStudio. Create an R Notebook document to write whatever is asked in this workshop.

You have to solve CHALLENGE exercises.

It is STRONGLY RECOMMENDED that you write your OWN NOTES as if this were your notebook. Your own workshop/notebook will be very helpful for your further study.

Keep saving your .Rmd file, and ONLY SUBMIT the .html version of your .Rmd file.

2 Review/improve your solution for W9

The solution for W9 for the 3 datasets is posted on the course site. You will see 3 solutions; one for each dataset. Check these solutions and compare with your workshop. Review your solution and improve your program to get the same results.

You have to submit the complete R code for your new version of W9. Try to use your own approach.

3 Write a function to calculate Value at Risk of a portfolio

You have to review/remember/learn what is Value at Risk (VaR) of a stock or a portfolio. You have to write a function with the following specifications:

INPUTS:

  1. historical returns of stocks that belong to a portfolio or stock
  2. Percentage/potential loss (it could be any %, but usually is 5%, 1% or 0.1%)
  3. Method to calculate VaR: 1 = assuming normal distribution, 2=using percentiles of the historical data

OUTPUT: The actual %VaR

You have to test your function to calculate the VaR using any daily stock return or any portfolio stock return.

You have to submit one R file with the new version of W9 and the code related to your function VaR.