Finance 310 - calculate a standard deviation for each


Ideas: Returns & Risk; Fixed Income

Work alone on the following problems. These are not too complicated, but the idea is to get you familiar with handling financial data. However, that is why I want you to work alone; do not work in groups.

For this homework, you must work with a particular equity ticker; I will give you this ticker in class. You also must turn in your R code. If you do not turn in your code, you get no points.

Data

You will need to download the following data from Quandl - a repository of public data. Tickers for Quandl are in parentheses.

- Constant maturity US Treasuries: 3M, 2Y, 10Y, and 30Y (FRED/DGS3MO, FRED/DGS2, FRED/DGS10,
FRED/DGS30)
- Indices: S&P 500, Russell 2000 (YAHOO/INDEX_GSPC, YAHOO/INDEX_RUT)
- Eurodollar futures (CHRIS/CME_ED1, CHRIS/CME_ED24)
- Your stock (YAHOO/YOURTICKER)

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"]

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

1. (Risk-Free Price Risk) When we say US Treasuries (USTs) are risk-free, we mean that their payoff is certain. (Well, as certain as can be for a USD-denominated investment.) However, you can lose money trading USTs since their prices change with interest rates. To get a handle on that capital gains risk, we will calculate some volatilities.

(a) 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).

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 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).

(d) 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).

2. (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).

(2)

(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 (remem- bering that there are about 250 trading days/year) and report the scaled semideviations.

(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) 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.

3. (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) 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.

(b) 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?

(c) Calculate daily log-returns, differences in logs of daily prices, for all three equity instru- ments. Find the average log-return for each equity instrument.

(d) How do these average daily log-returns (when annualized) compare to average UST yields? Does this make sense? Why?
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) 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.

Request for Solution File

Ask an Expert for Answer!!
Basic Statistics: Finance 310 - calculate a standard deviation for each
Reference No:- TGS01624500

Expected delivery within 24 Hours