# Market risk stress testing?

I am doing a research for a paper for market risk stress testing. In fact I found some information on the web about this important topic such as:

However, this papers are mostly theoretical and do not talk about best practices or specific examples of market risk stress tests. I really would value a simple R example to understand the underlying calculations?

One of the easiest ways is described in Duffie, Pan (1997) "Bootstrapped Simulation from Historical Data" p.55.

$R$ is the set of all risk factors (a time series) $C_{norm}$ is the Covariance Matrix during normal times. $C_{stressed}$ is the Covariance Matrix from a period of stress.

You can update $R$ in the following way.

$R_{i,stressed}=C_{stressed}^{1/2}* C_{norm}^{-1/2}*R_{i,norm}$

This can be implemented in R in the following way:

Rstressed = Rnorm %*% solve(chol(cov(Rnorm))) %*% chol(cov(Rstressperiod))


Checking

cov(Rstressed)
cov(Rstressperiod)


will yield identical results.