## 15.1 Simulated VaR with simple and continuous returns

When working with simulations, we can choose if we want to use simple or continuous returns to simulate future prices.

### 15.1.1 Simple returns

If we want to work with simple returns, we calculate one-day future prices in the following way:

1. Simulate one-day return: $$R_{t+1} \sim \mathcal{N}(0,\sigma^2)$$
2. Calculate one-day future price: $$P_{t+1} = P_t \times (1+R_{t+1})$$

### 15.1.2 Continuous returns

If we want to work with continuous returns, we calculate one-day future prices in the following way:

1. Simulate one-day return: $$y_{t+1} \sim \mathcal{N}(0,\sigma^2)$$
2. Calculate one-day future price: $$P_{t+1} = P_t e^{r(1/365)} \times e^{y_{t+1}} \times e^{-0.5\sigma^2}$$

### 15.1.3 Comparison for VaR 5%

library(repr)
options(repr.plot.width=8, repr.plot.height=4)
options(repr.matrix.max.rows=600, repr.matrix.max.cols=400)
# Simple returns
p = 0.05
S = 1e5
P = 100
sigma = 0.01
ret = rnorm(S, 0, sigma^2)
Psim_simple = P*(1+ret)

# VaR 5%
Ps_simple = sort(Psim_simple - P)
Ps_simple[p*S]
-0.0164945720378853
# Compound returns
r = 0.03   # Assuming risk free rate
Psim_comp = P*exp(r*(1/365))*exp(ret)*exp(-0.5*sigma^2)
# VaR 5%
Ps_comp = sort(Psim_comp - P)
Ps_comp[p*S]
-0.0132745128142631