Quantitative Risk Management

Proving the Weaknesses of Normality Assumption for Return Data in Calculating Value at Risk

Weakness #1: Possibility of Achieving Loss Greater Than the Initial Investment

Loading the Required Packages and Getting the Data

library(tidyquant)
library(tidyverse)

jago_stock <- tq_get("ARTO.JK",
                    get = "stock.prices",
                    from = "2022-09-01")

Calculating the Arithmetic Return for BBNI

r_jago <- NULL

for (i in seq_len(length(jago_stock$close) - 1)) {
  r_jago[i + 1] <- (jago_stock$close[i + 1] - jago_stock$close[i])/jago_stock$close[i]
}

Calculating the Value at Risk with 95% Confidence Level for Each Assets

alpha_cl <- qnorm(0.05)

VaR_jago_1_hari <- - (AVERAGE(r_jago) * 1 + alpha_cl * STDEV(r_jago) * sqrt(1)) * tail(jago_stock$close, 1)
VaR_jago_1_minggu <- - (AVERAGE(r_jago) * 5 + alpha_cl * STDEV(r_jago) * sqrt(5)) * tail(jago_stock$close, 1)
VaR_jago_1_tahun <- - (AVERAGE(r_jago) * 264 + alpha_cl * STDEV(r_jago) * sqrt(264)) * tail(jago_stock$close, 1)
VaR_jago_10_tahun <- - (AVERAGE(r_jago) * 2640 + alpha_cl * STDEV(r_jago) * sqrt(2640)) * tail(jago_stock$close, 1)

tibble(VaR_jago_1_hari, VaR_jago_1_minggu, VaR_jago_1_tahun, VaR_jago_10_tahun)
## # A tibble: 1 x 4
##   VaR_jago_1_hari VaR_jago_1_minggu VaR_jago_1_tahun VaR_jago_10_tahun
##             <dbl>             <dbl>            <dbl>             <dbl>
## 1            127.              306.            3985.            26558.

Weakness #3: There is Excess Kurtosis in the Return Data Which Makes the VaR to be the Underestimation of the Actual Value

Calculating the Kurtosis of the Profit/Loss

kurtosis(r_jago) + 3
## [1] 9.723408

The “+ 3” is used because the function kurtosis() from package PerformanceAnalytics inside the tidyquant ecosystem is calculating excess kurtosis instead of kurtosis.

Simulating Normal Distribution Data Using Information from Real Data

set.seed(211)
generated_data <- rnorm(length(r_jago), AVERAGE(r_jago), STDEV(r_jago))
head(generated_data, 15)
##  [1] -0.037477979  0.079988952 -0.033098516 -0.093276242  0.034561886
##  [6] -0.045144600  0.021017303 -0.030722279  0.025421019  0.030928025
## [11] -0.006803987  0.026910756 -0.021332196 -0.001369025 -0.024155182

Calculating the Kurtosis of the Simulated/Generated Data

kurtosis(generated_data) + 3
## [1] 3.269707