0% found this document useful (0 votes)
63 views1 page

Introduction To Financial Risk Management (With R) Exercise 4 - Longer Horizon Returns of Gold

This document provides instructions for calculating longer horizon log returns and discrete returns for gold prices. It first discusses calculating weekly, monthly, quarterly and yearly returns for the Wilshire 5000 index as an example. It then instructs the reader to use the gold price data series from previous exercises to calculate longer horizon log returns and discrete returns for gold in the same manner - by applying sum functions to the log returns over different time periods.

Uploaded by

Avanish Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views1 page

Introduction To Financial Risk Management (With R) Exercise 4 - Longer Horizon Returns of Gold

This document provides instructions for calculating longer horizon log returns and discrete returns for gold prices. It first discusses calculating weekly, monthly, quarterly and yearly returns for the Wilshire 5000 index as an example. It then instructs the reader to use the gold price data series from previous exercises to calculate longer horizon log returns and discrete returns for gold in the same manner - by applying sum functions to the log returns over different time periods.

Uploaded by

Avanish Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Introduction to Financial Risk Management (with R)

Exercise 4 – Longer Horizon Returns of Gold

Overview
The goal of this exercise is to use R to calculate weekly, monthly, quarterly, and yearly log
returns and discrete returns for Gold.

Longer Horizon Returns of the Whilshire 5000 Index from FRED


In the lectures, we ran the following R script to create a data series called “wilsh”:
library(quantmod)
getSymbols("WILL5000IND",src="FRED")
wilsh <- na.omit(WILL5000IND)
wilsh <- wilsh["1979-12-31/2017-12-31"]
names(wilsh) <- "TR"

Next, we calculated its daily log returns:


logret <- diff(log(wilsh))[-1]

We then used the following R commands to calculate longer horizon log returns:
logret.w <- apply.weekly(logret,sum)
logret.m <- apply.monthly(logret,sum)
logret.q <- apply.quarterly(logret,sum)
logret.y <- apply.yearly(logret,sum)

From these series, we calculated longer horizon discrete returns:


ret.w <- exp(logret.w)-1
ret.m <- exp(logret.m)-1
ret.q <- exp(logret.q)-1
ret.y <- exp(logret.y)-1

Longer Horizon Returns of Gold


In Exercise 2, you retrieved the price of gold in the London Bullion Market at 3pm from FRED:
“GOLDPMGBD228NLBM”
In Exercise 3, you calculated the log returns of Gold from 1979-12-31 to 2017-12-31.
In this exercise, you will calculate the weekly, monthly, quarterly, and yearly log returns and
discrete returns for Gold.

You might also like