Aggregating log-returns

Quantitative Risk Management in R

Alexander McNeil

Professor, University of York

Aggregating log-returns

  • Just add them up!
  • Assume $(X_t)$ are daily log-returns calculated from risk-factor values $(Z_t)$
  • Log-returns for a trading week is the sum of log-returns for each trading day:

$$\ln(Z_{t+5}) - \ln(Z_t) = \sum_{i=1}^{5} X_{t+i} $$

  • Similar for other time horizons
Quantitative Risk Management in R

Aggregating log-returns in R

  • Use the sum() function within apply.weekly() and use apply.monthly() in the xts package
sp500x_w <- apply.weekly(sp500x, sum)
head(sp500x_w, n = 3)
                 ^GSPC
1950-01-09  0.02489755
1950-01-16 -0.02130264
1950-01-23  0.01189081

$$ $$ $$ $$

sp500x_m <- apply.monthly(sp500x, sum)
head(sp500x_m, n = 3)
                 ^GSPC
1950-01-31 0.023139508
1950-02-28 0.009921296
1950-03-31 0.004056917
Quantitative Risk Management in R

Let's practice!

Quantitative Risk Management in R

Preparing Video For Download...