Get startedGet started for free

Equity and implied volatility risk factors

To analyze the risk of a portfolio consisting of an option, it is necessary to consider changes in all three risk factors: stock price, volatility and interest rates. Here, you will focus on the first two of these risk factors and assume that interest rates do not change much over short time intervals. The daily risk-factor values for the period 1990-2010 are contained in riskfactors and the corresponding log-returns in returns; both multivariate datasets are loaded in your workspace.

Volatility is a new risk factor that hasn't been considered so far in this course. It is represented by the VIX index which is constructed from the implied volatilities of a wide range of options on the S&P 500 index:

> names(returns)
[1] "X.GSPC" "X.VIX"

In this exercise, you will be able to verify whether the log-returns of volatility behave like other return data you have encountered, and to see how they vary with the log-returns of the S&P 500 index.

This exercise is part of the course

Quantitative Risk Management in R

View Course

Exercise instructions

  • Use the appropriate function to plot the data in riskfactors and in returns.
  • Use plot() and as.matrix() in succession to create a scatterplot of returns.
  • Use apply() to conduct the Jarque-Bera test on returns, and then use qqnorm() and brackets for indexing to make a Q-Q plot against normal for the log-returns of the series in returns containing volatility data.
  • Create the sample acf plot of the data in returns and then the absolute returns of the data.
  • Use cor() to calculate the correlation between the log-returns of the two risk factors in returns.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Plot the risk factors and the log-returns



# Make a scatterplot of the two return series


# Apply the Jarque-Bera test to the returns and make a Q-Q plot of the volatility log-returns



# Create the sample acf of the returns and absolute returns



# Calculate the correlation between the log-returns
Edit and Run Code