Solution Code: 1AGJE
This assignment falls under R Studio which was successfully solved by the assignment writing experts at My Assignment Services AU under assignment help service.
Data
You will need to download the following data from Quandl — a repository of public data. Tickers for Quandl are in parentheses.
The bond data are yields, so they need to be rescaled to be on the same scale as log-returns (divide them by 100). The index and equity prices need to be corrected for splits and dividends (use the adjusted close field). Finally: Restrict your analysis to 1 September 2013–1 September 2016 (including the start and end dates).
Analysis Software
To make life easy (really!), we will use R with the Quandl, xts, and PerformanceAnalytics packages for the analysis.1 To get working with R, use the market trading lab: sign up for some of the short tutorials offered there — or download the tutorial slides and go through them yourself. Go to go.uic.edu/cme_lab to sign up and get slides.
To install a package: go to the Package Manager in R; get the list of packages from CRAN; and, find the package by name. Highlight the package name, check the box for “Install dependencies,” and then click install. Once PerformanceAnalytics is installed, for example, you can use the SemiDeviation function.
Example R Code
Below is some R code to get you started. Paste this into a file where you can then modify the code.
library(Quandl) library(xts) library(PerformanceAnalytics)
# Line that start with a hash mark are comments. Comments are # crucial: They explain what you are doing. That helps you remember # what you did later; lets other people take over your job (when you # get promoted); and, helps you/others fix the analysis quickly when # it breaks. (All analyses break eventually.)
# Example of reading in a Quandl dataset to xts. # Name columns so we know what each holds after joining them together ust.tickers <- c("FRED/DGS3MO", "FRED/DGS2", "FRED/DGS10", "FRED/DGS30") ust.raw <- Quandl(ust.tickers, type="xts")/100 colnames(ust.raw) <- c("T3M", "T2Y", "T10Y", "T30Y")
# This is a way to get approximate returns for these bonds. # Those of you who take FIN 310 will learn why we can do this. ust.yieldchanges <- diff(ust.raw) ust[,"T3M"] <- -0.25*ust.yieldchanges[,"T3M"] ust[,"T2Y"] <- -1.98*ust.yieldchanges[,"T2Y"] ust[,"T10Y"] <- -8.72*ust.yieldchanges[,"T10Y"] ust[,"T30Y"] <- -19.2*ust.yieldchanges[,"T30Y"]
# Get Eurodollar futures (settlement) prices and create log-returns. ed1.raw <- Quandl("CHRIS/CME_ED1", type="xts")[,"Settle"]
1You may download R from www.r-project.org. The xts package handles time series data very nicely, taking care of date alignment when doing math or combining data series. The xts package is used worldwide and was written by Jeff Ryan. . . who graduated from UIC in 2004.
ed1 <- diff(log(ed1.raw)) colnames(ed1) <- c("ED1")
# Get S&P 500 prices (just adjusted close); then create log-returns. # Do similarly for the Russell 2000, and your stock. spx.raw <- Quandl("YAHOO/INDEX_GSPC", type="xts")[,"Adjusted Close"] spx <- diff(log(spx.raw)) colnames(spx) <- c("SPX")
# Join all of the datasets together: US Treasuries, Eurodollars, # S&P 500, Russell 2000, and your stock. Then trim them down. alldata.full <- cbind(ust, ed1, ed24, spx, rut, yourticker) alldata <- alldata.full["20120901/20150901"]
# Calculate annual volatilities and semideviations like so: apply(alldata, 2, sd)*sqrt(250) SemiDeviation(alldata)*sqrt(250)
# skewness and kurtosis are independent of time; no need to scale them skewness(alldata, method="moment") kurtosis(alldata, method="moment")
Analysis
Problems
(a) (4) We want to get daily yields for some USTs at four tenors (times to maturity): 3M, 2Y, 10Y, and 30Y. Since a 3M T-bill expires in three months, we obviously cannot use the same bill over a two-year period. Therefore, the Fed creates yield series called constant maturity treasuries (CMTs). CMT rates are averages of yields for instruments maturing near a certain amount of time. We use these to infer the yield for a certain maturity. Get daily yields over the past three years for those four instruments. The yields are quoted in percentage points; thus yields of “1.23” and “0.002” are yields of 1.23% and 0.002% (i.e. 0.2 basis points). What is the average yield for each of these instruments over the three years?
(b) We cannot calculate daily log-returns for CMTs. Therefore, we must use an approximation. To do this requires two steps: First, compute the changes in yields. Then, multiply those changes by the following numbers: -0.25 (3M), -1.98 (2Y), -8.72 (10Y), and -19.20 (30Y).2 2These numbers are related to the average time of a bond’s cashflows. We’ll get to that later. The result is a percent change for the bond price, on the same scale as the bond yields. Find the average of these approximated log-returns for each of the four maturities
(c)Using these approximated daily log-returns, calculate a standard deviation for each matu- rity. These are estimates of daily log-return volatilities. Scale them up to an annual basis (remembering that there are about 250 trading days/year). (d) (8) Again using the approximated daily log-returns, calculate a semi-deviation for each ma- turity. These are estimates of daily log-return semi-deviation. Scale them up to an annual basis (remembering that there are about 250 trading days/year).
(Short-term Credit and Price Risk) While we say US Treasuries (USTs) are risk-free, this is not true for money deposited in a bank: That bank can fail. Eurodollar futures can be used to hedge the rate paid for large US dollar deposits in a top-credit London bank. (That rate is called LIBOR, the London Interbank Offered Rate.) Eurodollar futures are some of the most actively-traded instruments in the world. Because banks and finance firms often anticipate cashflows well into the future, Eurodollar futures are not just liquid for a few maturities but for many maturities.
For this question, you should look at near Eurodollars (ED1) which are used to hedge three- month rate risk and Eurodollars about two-years out (ED24).
(a) Since Eurodollar futures trade at prices (not yields), we can easily calculate daily log- returns for them. Using these daily log-returns, calculate a standard deviation for each maturity. These are estimates of daily log-return volatilities. Scale them up to an annual basis (remembering that there are about 250 trading days/year). Report the scaled-up volatilities.
(b) Again using the daily log-returns, calculate a semi-deviation for each maturity. These are estimates of daily log-return semi-deviation. Scale them up to an annual basis (remembering that there are about 250 trading days/year) and report the scaled semi deviations.
(c) Compare the volatilities of these Eurodollar contracts to the volatilities of similar-term CMTs. How different are the volatilities? Why would this be?
(d) (4) Now we will examine a credit spread. The TED spread is the amount that short-term Eurodollars (the “ED” in TED) yield over a similar-term US Treasury instrument (the “T” in TED). To compute what 3M Eurodollars are yielding, just subtract their price from 100. So if 3M Eurodollars are at 99.735, that implies a yield of 100?99.735 = 0.265 aka 0.265% or 26.5 basis points (bp). The TED spread is then found by subtracting the 3M CMT yield from this number. If the 3M CMT UST is yielding 0.03% (3 bp), then the TED spread is 23.5 bp. Calculate and report the historical average, volatility, and semideviation for the TED spread.
(Equity Price Risk) Stocks are not risk-free: they may be rendered worthless (or nearly so) in bankruptcy; and, dividends may be reduced or suspended. All of these possibilities affect the risk of stocks. To get a handle on that risk and how it compares to price risk for USTs, we will calculate more volatilities.
For these questions, use the ticker assigned to you. (For example, if my ticker were DAL its Quandl ticker would be YAHOO/DAL.)
(a) (3) Get daily prices over the past three years for your stock, the S&P 500, and the Russell 2000.
3 This means you will be working with three equity instruments. For your stock, make sure you get prices that are adjusted for dividends and splits; or, you may get dividends and splits and do the adjustments yourself. What is the average price of each of the equity instruments over the past three years
(b) Calculate daily log-returns, differences in logs of daily prices, for all three equity instruments. Find the average log-return for each equity instrument.
(c)How do these average daily log-returns (when annualized) compare to average UST yields? Does this make sense? Why?
(d)Using the daily log-returns, calculate a standard deviation of log-returns for each equity instrument. These are estimates of daily volatility. Scale them up to an annual basis (remembering that there are about 250 trading days/year).
(e) Again using the daily log-returns, calculate a semi-deviation of log-returns for each equity instrument. These are estimates of daily semi-deviation. Scale them up to an annual basis (remembering that there are about 250 trading days/year).
(f) How do the volatilities and semi-deviation compare between the equity instruments and USTs? Does this make sense? Why?
(4) Save the data and, if you used R, the commands you used to do this homework. Print out your answers AND all the commands — and turn both in. Note that if you do not turn in your code, you will get no credit for this assignment. Also, if the code you turn in does not actually work, you will lose points. You will use the commands and data in Homework 2, so getting these points will make your life easier later.
The assignment file was solved by professional R Studio experts and academic professionals at My Assignment Services AU. The solution file, as per the marking rubric, is of high quality and 100% original (as reported by Plagiarism). The assignment help was delivered to the student within the 2-3 days to submission.
Looking for a new solution for this exact same question? Our assignment help professionals can help you with that. With a clientele based in top Australian universities, My Assignment Services AU’s assignment writing service is aiding thousands of students to achieve good scores in their academics. Our R Studio assignment experts are proficient with following the marking rubric and adhering to the referencing style guidelines.
In finance, volatility is defined as the amount of variation the trading prices will vary over time and is measured using the standard deviation of returns. The historic volatility is calculated using the information gathered from past market prices. For example, an indirect volatility is computed from the market price obtained from a market traded derivative
The R coding output is given below
Going through the output, we see that semi deviation of 3 month, 2 year, 30 year, EDI and adjusted close values are 0.0003, 0.0055, 0.0473, 0.1023, 0.00138 and 2705.905 respectively.
The table given below shows the workings of bond price for the four maturities
Maturity | Bond Price |
3M | -0.0075 |
2Y | -0.01089 |
10Y | -0.4125 |
30Y | -0.201 |
Going through the output, we see that semi deviation of 3 month, 2 year, 30 year, EDI and adjusted close values are 0.0003, 0.0055, 0.0473, 0.1023, 0.00138 and 2705.905 respectively.
The output for Ed1 is given below
Going through the output, we see that semi deviation of 3 month, 2 year, 30 year, EDI and adjusted close values are 0.0003, 0.0055, 0.0473, 0.1023, 0.00138 and 2705.905 respectively.
On comparing the volatilities of these Eurodollar contracts to the volatilities of similar term CMTs, we see that both are similar in volatilities
The average daily prices of three stocks is given below
The standard deviation of three log returns for each equity instrument is calculated and is given below
The table given below shows the workings of bond price for the four maturities
Stocks | Bond Price |
K | 68.22 |
S & P 500 | 2056 |
Russel 2000 | 114.61 |
The volatilities of these average daily log returns was compared to average UST yields to determine the variation in the daily prices
This R Studio assignment sample was powered by the assignment writing experts of My Assignment Services AU. You can free download this R Studio assessment answer for reference. This solved R Studio assignment sample is only for reference purpose and not to be submitted to your university. For a fresh solution to this question, fill the form here and get our professional assignment help.
Trending now
The Student Corner
Subscribe to get updates, offers and assignment tips right in your inbox.
Popular Solutions
Popular Solutions
Request Callback
Doing your Assignment with our resources is simple, take Expert assistance to ensure HD Grades. Here you Go....
🚨Don't Leave Empty-Handed!🚨
Snag a Sweet 70% OFF on Your Assignments! 📚💡
Grab it while it's hot!🔥
Claim Your DiscountHurry, Offer Expires Soon 🚀🚀