ORIE/STSCI 5640, Spring 2023 Computer Laboratory 2: Fixed Income Securities and Exploratory Data Analysis
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
ORIE/STSCI 5640, Spring 2023
Computer Laboratory 2: Fixed Income Securities and Exploratory Data Analysis
This assigned work should be handed in as Computer Laboratory #2 via Canvas by Feb 7 11:59pm, 2023.
Include your R code with your homework. This will allow the grader to help you find errors if you make any and to give partial credit. The point value of each question is in square brackets, for example [15].
Do not print an excessive number of digits when printing R output; use the options() or round() function to control the number of digits.
Add a title to your plots and add a legend when several curves appear on the same plot. Use appropriate labels for the axes and make sure that the font sizes of figures are not too small. They should be roughly the same size as in the text.
1. The data.frame yields in the R data file TreasuryYields .RData contains daily yields at 12 maturities. Run the following code to load the data, examine the beginning and end of the data.frame, and extract the date and yields as separate variables.
load("TreasuryYields .RData")
head(yields)
tail(yields)
T = c(1/12,1/6,1/4,1/2,1,2,3,5,7,10,20,30)
date = yields$date
yields = yields[,-1]
Plot yields on 2020-12-24 again maturity in years. You can extract yields at this date with the code yields[which(date=="2020-12-24"),] . Then use the lines() function to add the yields on the last trading day before Dec 25 for each of the years 2015–2019. Use a different color for each year.
2. Repeat Problem 1 but using forward rates instead of yields. [30]
3. Use the function getSymbols() in the quantmod package to obtain Verizon (VZ) prices from 2012-12-31 to 2020-12-31. Extract the adjusted closing prices and compute daily log returns. Create QQ plots of the Verizon log returns versus t- quantiles with tail index (degrees of freedom) equal to 3, 4, 5, 6, 8, and 10.
Do the log returns seem to follow a t-distribution at least approximately? If so, with what tail index? [40]
2023-02-09