6.1 RiskMetrics approach
- J. P. Morgan developed the RiskMetrics approach to VaR and ES calculation, by assuming that the daily returns follow a conditional normal distribution with zero mean and conditional variance which evolves similary to IGARCH(1,1) without drift
rt∼N(0, σ2t) rt−0σt∼N(0, 1)σ2t=(1−α)r2t−1+ασ2t−1
According to above asummptions, the 1−step ahead mean μt+1=0 and 1−step ahead variance is σ2t+1=(1−α)r2t+ασ2t given by 0<α<1. Consequently, the Value–at-Risk for a next trading day is simple to obtain VaR1−p=zp√σ2t+1
Keep in mind that for next k trading days VaR can be adopted for k−days horizon by the rule of square root of time, i.e. VaR[k]1−p=√k×VaR1−p
An advantage of RiskMetrics is simplicity, but the normality assumption often results in underestimation of VaR. Moreover, when the mean return is not zero, and when the volatility model of the returns is not an IGARCH(1,1) model without drift, an econometric approach to VaR and ES is required. This means that any GARCH type model can be fitted based on any distribution of innovations
model1
and model2
to meta_returns
by using fGarch
package (one assuming a normal distribution and the other using a Student–t distribution of innovations). After fitting the models, volatility is forecasted for the next three periods. Using the provided RMeasure
function, VaR and ES are calculated at 95% and 99% confidence levels. The results from both distributional assumptions are then compared to assess the impact of distribution choice on risk estimation.
Solution
Copy the code lines below to the clipboard, paste them into an R Script file, and run them.
# Install the 'fGarch' package if not already installed
install.packages("fGarch")
library(fGarch)
# Fit a GARCH(1,1) model to the "meta_returns" assuming normal distribution
<- garchFit(~garch(1,1), data = meta_returns, trace = FALSE)
model1
# Print the summary of the fitted model
print(model1)
# Forecast the next 3 periods using the fitted GARCH model
<- predict(model1, 3)
forecasted1
# Display the forecasted values
forecasted1
# Define a function to calculate Value at Risk (VaR) and Expected Shortfall (ES)
<- function(mu, sigma, cond.dist = "norm", df = 0) {
RMeasure <- c(0.95, 0.99) # Set confidence levels
prob
if (cond.dist == "norm") {
# Use normal distribution quantiles and densities
<- qnorm(prob)
q1 <- dnorm(q1)
d1 <- mu + q1 * sigma
VaR <- mu + d1 * sigma / (1 - prob)
ES <- cbind(prob, VaR, ES)
tt
}
if (cond.dist == "std") {
# Ensure degrees of freedom is valid
if (df < 2.001) df <- 2.01
# Use Student-t distribution quantiles and densities
<- qstd(prob, nu = df)
q1 <- dstd(q1, nu = df)
d1 <- mu + q1 * sigma
VaR <- mu + sigma * (d1 / (1 - prob)) * (((df - 2) + q1^2) / (df - 1))
ES <- cbind(prob, VaR, ES)
tt
}
# Print the calculated risk measures
cat("\nRisk Measures for selected probabilities:\n")
print(tt)
}
# Calculate and display risk measures for 1-step ahead
RMeasure(0.0006069886, 0.02292009, cond.dist = "norm")
# Fit second GARCH(1,1) model assuming a Student-t distribution
<- garchFit(~garch(1,1), data = meta_returns, trace = FALSE, cond.dist = "std")
model2
# Print the summary of the fitted t-distribution model
print(model2)
# Forecast the next 3 periods using the t-distribution GARCH model
<- predict(model2, 3)
forecasted2
# Display the forecasted values
forecasted2
# Calculate and display risk measures under the Student-t distribution with specified degrees of freedom
RMeasure(0.001541993, 0.01946718, cond.dist = "std", df = 3.915)